You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2022/09/08 08:55:47 UTC

[hbase] branch branch-2 updated: HBASE-27362 CompactSplit.requestCompactionInternal may bypass compactionsEnabled check (#4768)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 88d1bd09428 HBASE-27362 CompactSplit.requestCompactionInternal may bypass compactionsEnabled check (#4768)
88d1bd09428 is described below

commit 88d1bd09428159c8219a9cf12b6bfc7d17a90042
Author: chenglei <ch...@apache.org>
AuthorDate: Thu Sep 8 16:39:12 2022 +0800

    HBASE-27362 CompactSplit.requestCompactionInternal may bypass compactionsEnabled check (#4768)
    
    Co-authored-by: comnetwork <co...@163.com>
    Signed-off-by: Duo Zhang <zh...@apache.org>
    (cherry picked from commit a26cbf105743de28c62a6442eba2ef04d17d46af)
---
 .../org/apache/hadoop/hbase/regionserver/CompactSplit.java  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java
index 1360a20c0f8..5b75d3414f1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java
@@ -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())