From 1f437ac221dac36d269f9bf500b3f491c465ae7a Mon Sep 17 00:00:00 2001 From: xcang Date: Mon, 22 Oct 2018 23:16:52 -0700 Subject: [PATCH] HBASE-21349 Do not run CatalogJanitor or Nomalizer when cluster is shutting down Signed-off-by: Michael Stack --- .../java/org/apache/hadoop/hbase/master/CatalogJanitor.java | 6 ++++-- .../main/java/org/apache/hadoop/hbase/master/HMaster.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java index 85150937e91..73fabf8ca7b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java @@ -111,14 +111,16 @@ public class CatalogJanitor extends ScheduledChore { protected void chore() { try { AssignmentManager am = this.services.getAssignmentManager(); - if (this.enabled.get() && !this.services.isInMaintenanceMode() && am != null && + if (this.enabled.get() && !this.services.isInMaintenanceMode() && + !this.services.getServerManager().isClusterShutdown() && am != null && am.isMetaLoaded() && !am.hasRegionsInTransition()) { scan(); } else { LOG.warn("CatalogJanitor is disabled! Enabled=" + this.enabled.get() + ", maintenanceMode=" + this.services.isInMaintenanceMode() + ", am=" + am + ", metaLoaded=" + (am != null && am.isMetaLoaded()) + ", hasRIT=" + - (am != null && am.hasRegionsInTransition())); + (am != null && am.hasRegionsInTransition()) + " clusterShutDown=" + this.services + .getServerManager().isClusterShutdown()); } } catch (IOException e) { LOG.warn("Failed scan of catalog table", e); 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 90e0e6c12ac..8eaa87d36b6 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 @@ -1781,12 +1781,14 @@ public class HMaster extends HRegionServer implements MasterServices { LOG.debug("Master has not been initialized, don't run region normalizer."); return false; } - + if (this.getServerManager().isClusterShutdown()) { + LOG.info("Cluster is shutting down, don't run region normalizer."); + return false; + } if (isInMaintenanceMode()) { LOG.info("Master is in maintenance mode, don't run region normalizer."); return false; } - if (!this.regionNormalizerTracker.isNormalizerOn()) { LOG.debug("Region normalization is disabled, don't run region normalizer."); return false;