File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
hbase-server/src/test/java/org/apache/hadoop/hbase Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -192,9 +192,15 @@ public void testRegionAssignmentAfterMasterRecoveryDueToZKExpiry() throws Except
192192 m .getZooKeeper ().close ();
193193 MockLoadBalancer .retainAssignCalled = false ;
194194 final int expectedNumOfListeners = countPermanentListeners (zkw );
195+ // the master could already been aborted by some background tasks but here we call abort
196+ // directly to make sure this will happen
195197 m .abort ("Test recovery from zk session expired" ,
196198 new KeeperException .SessionExpiredException ());
197- assertTrue (m .isStopped ()); // Master doesn't recover any more
199+ // it is possible that our abort call above returned earlier because of someone else has
200+ // already called abort, but it is possible that it has not finished the abort call yet so the
201+ // isStopped flag is still false, let's wait for sometime.
202+ TEST_UTIL .waitFor (5000 , () -> m .isStopped ()); // Master doesn't recover any more
203+
198204 // The recovered master should not call retainAssignment, as it is not a
199205 // clean startup.
200206 assertFalse ("Retain assignment should not be called" , MockLoadBalancer .retainAssignCalled );
You can’t perform that action at this time.
0 commit comments