-
Notifications
You must be signed in to change notification settings - Fork 3.3k
HBASE-29363: CompactSplit should not attempt to split secondary region replicas #7048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-29363: CompactSplit should not attempt to split secondary region replicas #7048
Conversation
if (server.getNumberOfOnlineRegions() > 0.9 * regionSplitLimit) { | ||
LOG.warn("Total number of regions is approaching the upper limit " + regionSplitLimit + ". " | ||
+ "Please consider taking a look at http://hbase.apache.org/book.html#ops.regionmgt"); | ||
} | ||
return (regionSplitLimit > server.getNumberOfOnlineRegions()); | ||
return (regionSplitLimit > server.getNumberOfOnlineRegions() | ||
&& ri.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the key change, every other part of this PR is just unit testing
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses HBASE-29363 by ensuring that secondary region replicas are not split during compaction procedures. Key changes include:
- Changing test lifecycle annotations to use instance-level setup/cleanup.
- Adding a new test case to verify that only primary replicas are split.
- Modifying the splitting logic in CompactSplit to check the region’s replica ID and increment a test counter.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactSplitThread.java | Updated test lifecycle annotations and added testFlushWithRegionReplicas for replica-specific split behavior. |
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplit.java | Refactored shouldSplitRegion to conditionally split only primary replicas and exposed a split counter for testing. |
Comments suppressed due to low confidence (1)
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactSplitThread.java:66
- Changing from class-level (@BeforeClass/@afterclass) to instance-level (@Before/@after) setup may slow down test execution by reinitializing the mini cluster for every test. If test isolation is not critical, consider reverting to class-level initialization to improve performance.
@Before
if (server.getNumberOfOnlineRegions() > 0.9 * regionSplitLimit) { | ||
LOG.warn("Total number of regions is approaching the upper limit " + regionSplitLimit + ". " | ||
+ "Please consider taking a look at http://hbase.apache.org/book.html#ops.regionmgt"); | ||
} | ||
return (regionSplitLimit > server.getNumberOfOnlineRegions()); | ||
return (regionSplitLimit > server.getNumberOfOnlineRegions() | ||
&& ri.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Since this condition ensures that only primary replicas are allowed to be split, consider adding a brief code comment or updating the documentation to clarify this behavior for future maintainers.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -90,6 +91,8 @@ public class CompactSplit implements CompactionRequester, PropagatingConfigurati | |||
private volatile ThreadPoolExecutor longCompactions; | |||
private volatile ThreadPoolExecutor shortCompactions; | |||
private volatile ThreadPoolExecutor splits; | |||
// Used in unit testing | |||
private int splitCounter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to not introduce field in normal code which is only used for testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, done
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
… replicas (#7048) Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit ae5400e)
… replicas (#7048) Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit ae5400e)
… replicas (#7048) Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit ae5400e)
… replicas (#7048) Signed-off-by: Duo Zhang <[email protected]> (cherry picked from commit ae5400e)
No description provided.