Skip to content

Commit b733485

Browse files
comnetworkApache9
authored andcommitted
HBASE-27362 CompactSplit.requestCompactionInternal may bypass compactionsEnabled check (apache#4768)
Co-authored-by: comnetwork <[email protected]> Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit a26cbf1)
1 parent f7f2d7e commit b733485

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,13 @@ public void switchCompaction(boolean onOrOff) {
302302
LOG.info("Re-Initializing compactions because user switched on compactions");
303303
reInitializeCompactionsExecutors();
304304
}
305-
} else {
306-
LOG.info("Interrupting running compactions because user switched off compactions");
307-
interrupt();
305+
setCompactionsEnabled(onOrOff);
306+
return;
308307
}
308+
309309
setCompactionsEnabled(onOrOff);
310+
LOG.info("Interrupting running compactions because user switched off compactions");
311+
interrupt();
310312
}
311313

312314
private void requestCompactionInternal(HRegion region, String why, int priority,
@@ -322,6 +324,11 @@ private void requestCompactionInternal(HRegion region, String why, int priority,
322324
private void requestCompactionInternal(HRegion region, HStore store, String why, int priority,
323325
boolean selectNow, CompactionLifeCycleTracker tracker,
324326
CompactionCompleteTracker completeTracker, User user) throws IOException {
327+
if (!this.isCompactionsEnabled()) {
328+
LOG.info("Ignoring compaction request for " + region + ",because compaction is disabled.");
329+
return;
330+
}
331+
325332
if (
326333
this.server.isStopped() || (region.getTableDescriptor() != null
327334
&& !region.getTableDescriptor().isCompactionEnabled())

0 commit comments

Comments
 (0)