HBASE-20808 Wrong shutdown order between Chores and ChoreService
Signed-off-by: Reid Chan <reidchan@apache.org>
This commit is contained in:
parent
6983f13460
commit
ae2c858c5e
|
@ -58,6 +58,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.hbase.ChoreService;
|
||||||
import org.apache.hadoop.hbase.ClusterId;
|
import org.apache.hadoop.hbase.ClusterId;
|
||||||
import org.apache.hadoop.hbase.ClusterMetrics;
|
import org.apache.hadoop.hbase.ClusterMetrics;
|
||||||
import org.apache.hadoop.hbase.ClusterMetrics.Option;
|
import org.apache.hadoop.hbase.ClusterMetrics.Option;
|
||||||
|
@ -72,7 +73,6 @@ import org.apache.hadoop.hbase.MetaTableAccessor;
|
||||||
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
||||||
import org.apache.hadoop.hbase.PleaseHoldException;
|
import org.apache.hadoop.hbase.PleaseHoldException;
|
||||||
import org.apache.hadoop.hbase.ReplicationPeerNotFoundException;
|
import org.apache.hadoop.hbase.ReplicationPeerNotFoundException;
|
||||||
import org.apache.hadoop.hbase.ScheduledChore;
|
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.TableDescriptors;
|
import org.apache.hadoop.hbase.TableDescriptors;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
|
@ -1255,12 +1255,6 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelChore(ScheduledChore chore) {
|
|
||||||
if (chore != null) {
|
|
||||||
chore.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void stopServiceThreads() {
|
protected void stopServiceThreads() {
|
||||||
if (masterJettyServer != null) {
|
if (masterJettyServer != null) {
|
||||||
|
@ -1271,8 +1265,11 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
LOG.error("Failed to stop master jetty server", e);
|
LOG.error("Failed to stop master jetty server", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.stopServiceThreads();
|
|
||||||
stopChores();
|
stopChores();
|
||||||
|
if (this.mobCompactThread != null) {
|
||||||
|
this.mobCompactThread.close();
|
||||||
|
}
|
||||||
|
super.stopServiceThreads();
|
||||||
CleanerChore.shutDownChorePool();
|
CleanerChore.shutDownChorePool();
|
||||||
|
|
||||||
LOG.debug("Stopping service threads");
|
LOG.debug("Stopping service threads");
|
||||||
|
@ -1350,21 +1347,20 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopChores() {
|
private void stopChores() {
|
||||||
cancelChore(this.expiredMobFileCleanerChore);
|
ChoreService choreService = getChoreService();
|
||||||
cancelChore(this.mobCompactChore);
|
if (choreService != null) {
|
||||||
cancelChore(this.balancerChore);
|
choreService.cancelChore(this.expiredMobFileCleanerChore);
|
||||||
cancelChore(this.normalizerChore);
|
choreService.cancelChore(this.mobCompactChore);
|
||||||
cancelChore(this.clusterStatusChore);
|
choreService.cancelChore(this.balancerChore);
|
||||||
cancelChore(this.catalogJanitorChore);
|
choreService.cancelChore(this.normalizerChore);
|
||||||
cancelChore(this.clusterStatusPublisherChore);
|
choreService.cancelChore(this.clusterStatusChore);
|
||||||
if (this.mobCompactThread != null) {
|
choreService.cancelChore(this.catalogJanitorChore);
|
||||||
this.mobCompactThread.close();
|
choreService.cancelChore(this.clusterStatusPublisherChore);
|
||||||
|
choreService.cancelChore(this.snapshotQuotaChore);
|
||||||
|
choreService.cancelChore(this.logCleaner);
|
||||||
|
choreService.cancelChore(this.hfileCleaner);
|
||||||
|
choreService.cancelChore(this.replicationBarrierCleaner);
|
||||||
}
|
}
|
||||||
cancelChore(this.clusterStatusPublisherChore);
|
|
||||||
cancelChore(this.snapshotQuotaChore);
|
|
||||||
cancelChore(this.logCleaner);
|
|
||||||
cancelChore(this.hfileCleaner);
|
|
||||||
cancelChore(this.replicationBarrierCleaner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2411,14 +2411,17 @@ public class HRegionServer extends HasThread implements
|
||||||
*/
|
*/
|
||||||
protected void stopServiceThreads() {
|
protected void stopServiceThreads() {
|
||||||
// clean up the scheduled chores
|
// clean up the scheduled chores
|
||||||
if (this.choreService != null) choreService.shutdown();
|
if (this.choreService != null) {
|
||||||
if (this.nonceManagerChore != null) nonceManagerChore.cancel(true);
|
choreService.cancelChore(nonceManagerChore);
|
||||||
if (this.compactionChecker != null) compactionChecker.cancel(true);
|
choreService.cancelChore(compactionChecker);
|
||||||
if (this.periodicFlusher != null) periodicFlusher.cancel(true);
|
choreService.cancelChore(periodicFlusher);
|
||||||
if (this.healthCheckChore != null) healthCheckChore.cancel(true);
|
choreService.cancelChore(healthCheckChore);
|
||||||
if (this.storefileRefresher != null) storefileRefresher.cancel(true);
|
choreService.cancelChore(storefileRefresher);
|
||||||
if (this.movedRegionsCleaner != null) movedRegionsCleaner.cancel(true);
|
choreService.cancelChore(movedRegionsCleaner);
|
||||||
if (this.fsUtilizationChore != null) fsUtilizationChore.cancel(true);
|
choreService.cancelChore(fsUtilizationChore);
|
||||||
|
// clean up the remaining scheduled chores (in case we missed out any)
|
||||||
|
choreService.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.cacheFlusher != null) {
|
if (this.cacheFlusher != null) {
|
||||||
this.cacheFlusher.join();
|
this.cacheFlusher.join();
|
||||||
|
|
Loading…
Reference in New Issue