diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java index 1963b8f07e0..416b8151c3b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java @@ -302,11 +302,13 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati LOG.info("Re-Initializing compactions because user switched on compactions"); reInitializeCompactionsExecutors(); } - } else { - LOG.info("Interrupting running compactions because user switched off compactions"); - interrupt(); + setCompactionsEnabled(onOrOff); + return; } + setCompactionsEnabled(onOrOff); + LOG.info("Interrupting running compactions because user switched off compactions"); + interrupt(); } private void requestCompactionInternal(HRegion region, String why, int priority, @@ -322,6 +324,11 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati private void requestCompactionInternal(HRegion region, HStore store, String why, int priority, boolean selectNow, CompactionLifeCycleTracker tracker, CompactionCompleteTracker completeTracker, User user) throws IOException { + if (!this.isCompactionsEnabled()) { + LOG.info("Ignoring compaction request for " + region + ",because compaction is disabled."); + return; + } + if ( this.server.isStopped() || (region.getTableDescriptor() != null && !region.getTableDescriptor().isCompactionEnabled())