Skip to content

HBASE-30258 Run getAllRegionLocations more times in TestMetaRegionRep…#8416

Merged
Apache9 merged 1 commit into
apache:masterfrom
Apache9:HBASE-30258
Jun 26, 2026
Merged

HBASE-30258 Run getAllRegionLocations more times in TestMetaRegionRep…#8416
Apache9 merged 1 commit into
apache:masterfrom
Apache9:HBASE-30258

Conversation

@Apache9

@Apache9 Apache9 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

…licaReplication to make it more stable

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Improves stability of TestMetaRegionReplicaReplication (HBASE-30258) by retrying meta-replica location lookups/reads to reduce flakiness under load-balanced meta replica selection, and by explicitly clearing a RegionServer “moved region” cache entry during the test.

Changes:

  • Switches meta read-increase assertions to Hamcrest matchers and adds a runAtMostNTimes retry helper to re-run operations until assertions pass.
  • Retries doNGets and RegionLocator#getAllRegionLocations() multiple times to reduce random miss probability in load-balance mode.
  • Exposes a RegionServer helper to remove a moved-region cache entry so the test doesn’t need to wait for cache expiry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetaRegionReplicaReplication.java Adds retry logic and updates assertions to make meta-replica replication test less flaky.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Makes moved-region cache invalidation callable from the test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3347 to 3349
public void removeFromMovedRegions(String encodedName) {
movedRegionInfoCache.invalidate(encodedName);
}
Comment on lines +479 to +480
// Same as above, we need to run it multiple times to make it stable. And numOfMetaRelicas is
// much less than HBaseTestingUtil.KEYS.length, so here we need to run more times.
Comment on lines +404 to +406
private void runAtMostNTimes(int times, Callable<?> action, Runnable assertion) throws Exception {
for (int i = 0; i < times - 1; i++) {
action.call();
@Apache9 Apache9 merged commit f49bda0 into apache:master Jun 26, 2026
8 checks passed
Apache9 added a commit that referenced this pull request Jun 26, 2026
…licaReplication to make it more stable (#8416)

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
(cherry picked from commit f49bda0)
Apache9 added a commit that referenced this pull request Jun 26, 2026
…licaReplication to make it more stable (#8416)

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
(cherry picked from commit f49bda0)
Apache9 added a commit that referenced this pull request Jun 26, 2026
…licaReplication to make it more stable (#8416)

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
(cherry picked from commit f49bda0)
Apache9 added a commit that referenced this pull request Jun 26, 2026
…licaReplication to make it more stable (#8416)

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
(cherry picked from commit f49bda0)
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