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 @@ -193,9 +193,15 @@ public void testRegionAssignmentAfterMasterRecoveryDueToZKExpiry() throws Except
193193      m .getZooKeeper ().close ();
194194      MockLoadBalancer .retainAssignCalled  = false ;
195195      final  int  expectedNumOfListeners  = countPermanentListeners (zkw );
196+       // the master could already been aborted by some background tasks but here we call abort 
197+       // directly to make sure this will happen 
196198      m .abort ("Test recovery from zk session expired" ,
197199        new  KeeperException .SessionExpiredException ());
198-       assertTrue (m .isStopped ()); // Master doesn't recover any more 
200+       // it is possible that our abort call above returned earlier because of someone else has 
201+       // already called abort, but it is possible that it has not finished the abort call yet so the 
202+       // isStopped flag is still false, let's wait for sometime. 
203+       TEST_UTIL .waitFor (5000 , () -> m .isStopped ()); // Master doesn't recover any more 
204+ 
199205      // The recovered master should not call retainAssignment, as it is not a 
200206      // clean startup. 
201207      assertFalse ("Retain assignment should not be called" , MockLoadBalancer .retainAssignCalled );
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments