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

Co-authored-by: comnetwork <comnetwork@163.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
chenglei 2022-09-08 16:39:12 +08:00 committed by GitHub
parent fa3bd7feb9
commit a26cbf1057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -315,11 +315,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,
@ -336,6 +338,11 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati
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())