Skip to content

Commit

Permalink
HBASE-27362 CompactSplit.requestCompactionInternal may bypass compact…
Browse files Browse the repository at this point in the history
…ionsEnabled check (#4768)

Co-authored-by: comnetwork <[email protected]>
Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
comnetwork and comnetwork authored Sep 8, 2022
1 parent fa3bd7f commit a26cbf1
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,13 @@ public void switchCompaction(boolean onOrOff) {
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,
Expand All @@ -336,6 +338,11 @@ private void requestCompactionInternal(HRegion region, String why, int priority,
protected 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())
Expand Down

0 comments on commit a26cbf1

Please sign in to comment.