From 2c9d7fde54ce83bf3c3365ca448b2f3298c32129 Mon Sep 17 00:00:00 2001 From: guluo Date: Thu, 6 Jul 2023 10:19:32 +0800 Subject: [PATCH] HBASE-27920 Skipping compact for this region if the table disable compaction (#5273) Signed-off-by: Duo Zhang Signed-off-by: Wellington Chevreuil (cherry picked from commit d1f29d06ece649c32caa2ae5551e9a67a540014a) --- .../org/apache/hadoop/hbase/regionserver/HRegionServer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 1c5940ca9aed..f9f841181064 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1638,8 +1638,9 @@ private static class CompactionChecker extends ScheduledChore { @Override protected void chore() { for (Region r : this.instance.onlineRegions.values()) { - // Skip compaction if region is read only - if (r == null || r.isReadOnly()) { + // If region is read only or compaction is disabled at table level, there's no need to + // iterate through region's stores + if (r == null || r.isReadOnly() || !r.getTableDescriptor().isCompactionEnabled()) { continue; }