This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new b8f71ec4878 HBASE-27193 TestZooKeeper is flaky (#4615)
b8f71ec4878 is described below

commit b8f71ec48783b16a6bc68e98254957bc034a77ae
Author: Duo Zhang <[email protected]>
AuthorDate: Wed Jul 13 10:32:01 2022 +0800

    HBASE-27193 TestZooKeeper is flaky (#4615)
    
    Signed-off-by: Guanghao Zhang <[email protected]>
    (cherry picked from commit 2662607b716bab12d5f01de013ba3349cff0d78c)
---
 .../src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java
index 25e406335a4..7e48ddf42d9 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java
@@ -192,9 +192,15 @@ public class TestZooKeeper {
       m.getZooKeeper().close();
       MockLoadBalancer.retainAssignCalled = false;
       final int expectedNumOfListeners = countPermanentListeners(zkw);
+      // the master could already been aborted by some background tasks but 
here we call abort
+      // directly to make sure this will happen
       m.abort("Test recovery from zk session expired",
         new KeeperException.SessionExpiredException());
-      assertTrue(m.isStopped()); // Master doesn't recover any more
+      // it is possible that our abort call above returned earlier because of 
someone else has
+      // already called abort, but it is possible that it has not finished the 
abort call yet so the
+      // isStopped flag is still false, let's wait for sometime.
+      TEST_UTIL.waitFor(5000, () -> m.isStopped()); // Master doesn't recover 
any more
+
       // The recovered master should not call retainAssignment, as it is not a
       // clean startup.
       assertFalse("Retain assignment should not be called", 
MockLoadBalancer.retainAssignCalled);

Reply via email to