Commit 0d5f014 1 parent c09918e commit 0d5f014 Copy full SHA for 0d5f014
File tree 2 files changed +10
-2
lines changed
compactor/src/main/java/org/apache/accumulo/compactor
tserver/src/main/java/org/apache/accumulo/tserver
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,7 @@ public String getQueueName() {
170
170
private ServerAddress compactorAddress = null ;
171
171
172
172
private final AtomicBoolean compactionRunning = new AtomicBoolean (false );
173
+ private volatile boolean shutdownComplete = false ;
173
174
174
175
protected Compactor (CompactorServerOpts opts , String [] args ) {
175
176
super ("compactor" , opts , args );
@@ -287,7 +288,9 @@ protected void announceExistence(HostAndPort clientAddress)
287
288
LockWatcher lw = new LockWatcher () {
288
289
@ Override
289
290
public void lostLock (final LockLossReason reason ) {
290
- if (isShutdownRequested ()) {
291
+ // ServiceLock.unlock is called at the end of run(). We don't
292
+ // want to Halt when we are shutting down.
293
+ if (isShutdownRequested () && shutdownComplete ) {
291
294
LOG .warn ("Compactor lost lock (reason = {}), not exiting because shutdown requested." ,
292
295
reason );
293
296
} else {
@@ -905,6 +908,7 @@ public void run() {
905
908
906
909
gcLogger .logGCInfo (getConfiguration ());
907
910
LOG .info ("stop requested. exiting ... " );
911
+ shutdownComplete = true ;
908
912
try {
909
913
if (null != compactorLock ) {
910
914
compactorLock .unlock ();
Original file line number Diff line number Diff line change @@ -240,6 +240,7 @@ public TabletServerMinCMetrics getMinCMetrics() {
240
240
private final ZooAuthenticationKeyWatcher authKeyWatcher ;
241
241
private final WalStateManager walMarker ;
242
242
private final ServerContext context ;
243
+ private volatile boolean shutdownComplete = false ;
243
244
244
245
public static void main (String [] args ) throws Exception {
245
246
try (TabletServer tserver = new TabletServer (new ServerOpts (), args )) {
@@ -686,7 +687,9 @@ private void announceExistence() {
686
687
687
688
@ Override
688
689
public void lostLock (final LockLossReason reason ) {
689
- if (isShutdownRequested ()) {
690
+ // ServiceLock.unlock is called at the end of run(). We don't
691
+ // want to Halt when we are shutting down.
692
+ if (isShutdownRequested () && shutdownComplete ) {
690
693
LOG .warn (
691
694
"TabletServer lost lock (reason = {}), not exiting because shutdown requested." ,
692
695
reason );
@@ -1027,6 +1030,7 @@ public void run() {
1027
1030
1028
1031
log .info ("TServerInfo: stop requested. exiting ... " );
1029
1032
1033
+ shutdownComplete = true ;
1030
1034
try {
1031
1035
tabletServerLock .unlock ();
1032
1036
} catch (Exception e ) {
You can’t perform that action at this time.
0 commit comments