Skip to content

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

Merged

Conversation

charlesconnell
Copy link
Contributor

No description provided.

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);
Copy link
Contributor Author

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

@Apache-HBase

This comment has been minimized.

@Apache9 Apache9 requested a review from Copilot June 1, 2025 14:28
Copy link

@Copilot Copilot AI left a 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);
Copy link
Preview

Copilot AI Jun 1, 2025

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 59s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
_ master Compile Tests _
+1 💚 mvninstall 4m 18s master passed
+1 💚 compile 3m 57s master passed
+1 💚 checkstyle 0m 41s master passed
+1 💚 spotbugs 1m 58s master passed
+1 💚 spotless 1m 7s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 55s the patch passed
+1 💚 compile 4m 0s the patch passed
+1 💚 javac 4m 0s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 47s the patch passed
+1 💚 spotbugs 2m 6s the patch passed
+1 💚 hadoopcheck 13m 52s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 spotless 1m 0s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 14s The patch does not generate ASF License warnings.
47m 32s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7048/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #7048
JIRA Issue HBASE-29363
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux d6cf2281e710 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / e284ab9
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 87 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7048/2/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 50s Docker mode activated.
-0 ⚠️ yetus 0m 4s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 12s master passed
+1 💚 compile 1m 19s master passed
+1 💚 javadoc 0m 44s master passed
+1 💚 shadedjars 6m 59s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 48s the patch passed
+1 💚 compile 1m 17s the patch passed
+1 💚 javac 1m 17s the patch passed
+1 💚 javadoc 0m 40s the patch passed
+1 💚 shadedjars 6m 53s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 303m 56s hbase-server in the patch passed.
336m 15s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7048/2/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #7048
JIRA Issue HBASE-29363
Optional Tests javac javadoc unit compile shadedjars
uname Linux 0873e821399b 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / e284ab9
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7048/2/testReport/
Max. process+thread count 4423 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-7048/2/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache9 Apache9 merged commit ae5400e into apache:master Jun 3, 2025
1 check passed
Apache9 pushed a commit that referenced this pull request Jun 3, 2025
… replicas (#7048)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit ae5400e)
Apache9 pushed a commit that referenced this pull request Jun 3, 2025
… replicas (#7048)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit ae5400e)
Apache9 pushed a commit that referenced this pull request Jun 3, 2025
… replicas (#7048)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit ae5400e)
Apache9 pushed a commit that referenced this pull request Jun 3, 2025
… replicas (#7048)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit ae5400e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants