HBASE-20808 Wrong shutdown order between Chores and ChoreService
Signed-off-by: Reid Chan <reidchan@apache.org>
This commit is contained in:
parent
154b77307f
commit
77e5668ed2
|
@ -51,6 +51,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.ChoreService;
|
||||
import org.apache.hadoop.hbase.ClusterStatus;
|
||||
import org.apache.hadoop.hbase.CoordinatedStateException;
|
||||
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
||||
|
@ -1284,8 +1285,8 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
|||
LOG.error("Failed to stop master jetty server", e);
|
||||
}
|
||||
}
|
||||
super.stopServiceThreads();
|
||||
stopChores();
|
||||
super.stopServiceThreads();
|
||||
CleanerChore.shutDownChorePool();
|
||||
|
||||
// Wait for all the remaining region servers to report in IFF we were
|
||||
|
@ -1298,10 +1299,6 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
|||
LOG.debug("Stopping service threads");
|
||||
}
|
||||
// Clean up and close up shop
|
||||
if (this.logCleaner != null) this.logCleaner.cancel(true);
|
||||
if (this.hfileCleaner != null) this.hfileCleaner.cancel(true);
|
||||
if (this.replicationZKLockCleanerChore != null) this.replicationZKLockCleanerChore.cancel(true);
|
||||
if (this.replicationZKNodeCleanerChore != null) this.replicationZKNodeCleanerChore.cancel(true);
|
||||
if (this.quotaManager != null) this.quotaManager.stop();
|
||||
if (this.activeMasterManager != null) this.activeMasterManager.stop();
|
||||
if (this.serverManager != null) this.serverManager.stop();
|
||||
|
@ -1355,23 +1352,18 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
|||
}
|
||||
|
||||
private void stopChores() {
|
||||
if (this.balancerChore != null) {
|
||||
this.balancerChore.cancel(true);
|
||||
}
|
||||
if (this.normalizerChore != null) {
|
||||
this.normalizerChore.cancel(true);
|
||||
}
|
||||
if (this.clusterStatusChore != null) {
|
||||
this.clusterStatusChore.cancel(true);
|
||||
}
|
||||
if (this.catalogJanitorChore != null) {
|
||||
this.catalogJanitorChore.cancel(true);
|
||||
}
|
||||
if (this.clusterStatusPublisherChore != null){
|
||||
clusterStatusPublisherChore.cancel(true);
|
||||
}
|
||||
if (this.periodicDoMetricsChore != null) {
|
||||
periodicDoMetricsChore.cancel();
|
||||
ChoreService choreService = getChoreService();
|
||||
if (choreService != null) {
|
||||
choreService.cancelChore(this.balancerChore);
|
||||
choreService.cancelChore(this.normalizerChore);
|
||||
choreService.cancelChore(this.clusterStatusChore);
|
||||
choreService.cancelChore(this.catalogJanitorChore);
|
||||
choreService.cancelChore(this.clusterStatusPublisherChore);
|
||||
choreService.cancelChore(this.periodicDoMetricsChore);
|
||||
choreService.cancelChore(this.logCleaner);
|
||||
choreService.cancelChore(this.hfileCleaner);
|
||||
choreService.cancelChore(this.replicationZKLockCleanerChore);
|
||||
choreService.cancelChore(this.replicationZKNodeCleanerChore);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1064,10 +1064,6 @@ public class HRegionServer extends HasThread implements
|
|||
if (this.hMemManager != null) this.hMemManager.stop();
|
||||
if (this.cacheFlusher != null) this.cacheFlusher.interruptIfNecessary();
|
||||
if (this.compactSplitThread != null) this.compactSplitThread.interruptIfNecessary();
|
||||
if (this.compactionChecker != null) this.compactionChecker.cancel(true);
|
||||
if (this.healthCheckChore != null) this.healthCheckChore.cancel(true);
|
||||
if (this.nonceManagerChore != null) this.nonceManagerChore.cancel(true);
|
||||
if (this.storefileRefresher != null) this.storefileRefresher.cancel(true);
|
||||
sendShutdownInterrupt();
|
||||
|
||||
// Stop the quota manager
|
||||
|
@ -2247,13 +2243,16 @@ public class HRegionServer extends HasThread implements
|
|||
*/
|
||||
protected void stopServiceThreads() {
|
||||
// clean up the scheduled chores
|
||||
if (this.choreService != null) choreService.shutdown();
|
||||
if (this.nonceManagerChore != null) nonceManagerChore.cancel(true);
|
||||
if (this.compactionChecker != null) compactionChecker.cancel(true);
|
||||
if (this.periodicFlusher != null) periodicFlusher.cancel(true);
|
||||
if (this.healthCheckChore != null) healthCheckChore.cancel(true);
|
||||
if (this.storefileRefresher != null) storefileRefresher.cancel(true);
|
||||
if (this.movedRegionsCleaner != null) movedRegionsCleaner.cancel(true);
|
||||
if (this.choreService != null) {
|
||||
choreService.cancelChore(nonceManagerChore);
|
||||
choreService.cancelChore(compactionChecker);
|
||||
choreService.cancelChore(periodicFlusher);
|
||||
choreService.cancelChore(healthCheckChore);
|
||||
choreService.cancelChore(storefileRefresher);
|
||||
choreService.cancelChore(movedRegionsCleaner);
|
||||
// clean up the remaining scheduled chores (in case we missed out any)
|
||||
choreService.shutdown();
|
||||
}
|
||||
|
||||
if (this.cacheFlusher != null) {
|
||||
this.cacheFlusher.join();
|
||||
|
|
Loading…
Reference in New Issue