Repository: hbase Updated Branches: refs/heads/branch-1.4 0d1fffbb4 -> 822c18a03
HBASE-20808 Wrong shutdown order between Chores and ChoreService Signed-off-by: Reid Chan <reidc...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/822c18a0 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/822c18a0 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/822c18a0 Branch: refs/heads/branch-1.4 Commit: 822c18a03ff274a398f6a037445df0d620d276e9 Parents: 0d1fffb Author: Nihal Jain <nihaljain...@gmail.com> Authored: Fri Jul 6 00:42:58 2018 +0530 Committer: Reid Chan <reidc...@apache.org> Committed: Sat Jul 7 00:34:17 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/822c18a0/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 9dcc3fd..18bfa74 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 @@ -50,6 +50,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; 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; @@ -1283,8 +1284,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 @@ -1297,10 +1298,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(); @@ -1341,23 +1338,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/822c18a0/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 dd01ea0..962a0e9 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();