HBASE-25361 [Flakey Tests] branch-2 TestMetaRegionLocationCache.testStandByMetaLocations (#2736)

Add a bit of a wait before testing if online replicas match the zk count. It might take a
while for all replicas to come online.

Signed-off-by: huaxiangsun <huaxiangsun@apache.org>
This commit is contained in:
Michael Stack 2020-12-05 08:55:59 -08:00 committed by stack
parent 3ff115ebe4
commit a0f4c28430
1 changed files with 8 additions and 0 deletions

View File

@ -98,6 +98,14 @@ public class TestMetaRegionLocationCache {
assertFalse(metaHRLs.isEmpty());
ZKWatcher zk = master.getZooKeeper();
List<String> metaZnodes = zk.getMetaReplicaNodes();
// Wait till all replicas available.
while (master.getMetaRegionLocationCache().getMetaRegionLocations().get().size() !=
metaZnodes.size()) {
Thread.sleep(1000);
if (++retries == 10) {
break;
}
}
assertEquals(metaZnodes.size(), metaHRLs.size());
List<HRegionLocation> actualHRLs = getCurrentMetaLocations(zk);
Collections.sort(metaHRLs);