Repository: hbase Updated Branches: refs/heads/branch-1 154b77307 -> 77e5668ed
HBASE-20808 Wrong shutdown order between Chores and ChoreService Signed-off-by: Reid Chan <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/77e5668e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/77e5668e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/77e5668e Branch: refs/heads/branch-1 Commit: 77e5668ed20b20c8b91128ee819927a26041272d Parents: 154b773 Author: Nihal Jain <[email protected]> Authored: Fri Jul 6 00:42:58 2018 +0530 Committer: Reid Chan <[email protected]> Committed: Sat Jul 7 00:32:33 2018 +0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/master/HMaster.java | 36 ++++++++------------ .../hbase/regionserver/HRegionServer.java | 21 ++++++------ 2 files changed, 24 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/77e5668e/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index cfa6aa2..21ec23c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -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); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/77e5668e/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 8512c2f..6c32643 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -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();
