Skip to content

Commit 10afd02

Browse files
committed
Refresh_meta triggering compaction on user table
Link to JIRA: https://issues.apache.org/jira/browse/HBASE-29644 Description: Consider the two cluster setup with one being active and one read replica. If active cluster create a table with FILE based SFT. If you add few rows through active and do flushes to create few Hfiles and then do refresh_meta from read replica its triggering minor compaction. Which should not happen via read replica, it may create inconsitencies because active is not aware of that event. Cause: This is happening because we should block the compaction event in ReadOnlyController but we missed adding read only guard to preCompactSelection() function. Fix: Add internalReadOnlyGuard to preCompactSelection() in ReadOnlyController
1 parent afe2274 commit 10afd02

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ReadOnlyController.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
import org.apache.hadoop.hbase.filter.Filter;
5454
import org.apache.hadoop.hbase.regionserver.FlushLifeCycleTracker;
5555
import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
56+
import org.apache.hadoop.hbase.regionserver.Store;
57+
import org.apache.hadoop.hbase.regionserver.StoreFile;
58+
import org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTracker;
5659
import org.apache.hadoop.hbase.util.Pair;
5760
import org.apache.hadoop.hbase.wal.WALEdit;
5861
import org.apache.yetus.audience.InterfaceAudience;
@@ -81,6 +84,7 @@ private void internalReadOnlyGuard() throws IOException {
8184

8285
@Override
8386
public void start(CoprocessorEnvironment env) throws IOException {
87+
8488
this.globalReadOnlyEnabled =
8589
env.getConfiguration().getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
8690
HConstants.HBASE_GLOBAL_READONLY_ENABLED_DEFAULT);
@@ -131,6 +135,13 @@ public void preFlush(final ObserverContext<? extends RegionCoprocessorEnvironmen
131135
internalReadOnlyGuard();
132136
}
133137

138+
@Override
139+
public void preCompactSelection(ObserverContext<? extends RegionCoprocessorEnvironment> c,
140+
Store store, List<? extends StoreFile> candidates, CompactionLifeCycleTracker tracker)
141+
throws IOException {
142+
internalReadOnlyGuard();
143+
}
144+
134145
@Override
135146
public boolean preCheckAndPut(ObserverContext<? extends RegionCoprocessorEnvironment> c,
136147
byte[] row, byte[] family, byte[] qualifier, CompareOperator op, ByteArrayComparable comparator,

0 commit comments

Comments
 (0)