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,12 +302,14 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati
LOG.info("Re-Initializing compactions because user switched on compactions");
reInitializeCompactionsExecutors();
}
} else {
setCompactionsEnabled(onOrOff);
return;
}
setCompactionsEnabled(onOrOff);
LOG.info("Interrupting running compactions because user switched off compactions");
interrupt();
}
setCompactionsEnabled(onOrOff);
}
private void requestCompactionInternal(HRegion region, String why, int priority,
boolean selectNow, CompactionLifeCycleTracker tracker,
@ -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())