HBASE-27362 CompactSplit.requestCompactionInternal may bypass compactionsEnabled check (#4768)

Co-authored-by: comnetwork <comnetwork@163.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit a26cbf1057)
This commit is contained in:
chenglei 2022-09-08 16:39:12 +08:00 committed by Duo Zhang
parent f7f2d7e1ae
commit b73348515e
1 changed files with 10 additions and 3 deletions

View File

@ -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())