From 6791b29771892dff7ae8d16de2c99502162f2e69 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Sat, 5 Dec 2020 08:55:59 -0800 Subject: [PATCH] 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 --- .../hadoop/hbase/client/TestMetaRegionLocationCache.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaRegionLocationCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaRegionLocationCache.java index d42c1240f9e..577e15cedfb 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaRegionLocationCache.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaRegionLocationCache.java @@ -98,6 +98,14 @@ public class TestMetaRegionLocationCache { assertFalse(metaHRLs.isEmpty()); ZKWatcher zk = master.getZooKeeper(); List 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 actualHRLs = getCurrentMetaLocations(zk); Collections.sort(metaHRLs);