From 94f84244cb28b3f15ea890acbd52104965a3d925 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 2a4816777f53..62e781de0d1a 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 @@ -1846,7 +1846,9 @@ private static class CompactionChecker extends ScheduledChore { @Override protected void chore() { for (Region r : this.instance.onlineRegions.values()) { - if (r == null) { + // 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; } HRegion hr = (HRegion) r;