File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed 
main/java/org/apache/hadoop/hbase/master/zksyncer 
test/java/org/apache/hadoop/hbase/client Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -196,12 +196,16 @@ private void deleteDataForClientZkUntilSuccess(String node) throws InterruptedEx
196196      LOG .debug ("Delete remote "  + node  + ", client zk wather: "  + clientZkWatcher );
197197      try  {
198198        ZKUtil .deleteNode (clientZkWatcher , node );
199+         break ;
199200      } catch  (KeeperException  e ) {
201+         if  (e .code () == KeeperException .Code .NONODE ) {
202+           LOG .debug ("Node is already deleted, give up" , e );
203+           break ;
204+         }
200205        LOG .debug ("Failed to delete node from client ZK, will retry later" , e );
201206        if  (e .code () == KeeperException .Code .SESSIONEXPIRED ) {
202207          reconnectAfterExpiration ();
203208        }
204- 
205209      }
206210    }
207211  }
Original file line number Diff line number Diff line change @@ -133,15 +133,10 @@ public void testMasterSwitch() throws Exception {
133133      HMaster  master  = cluster .getMaster ();
134134      master .stopMaster ();
135135      LOG .info ("Stopped master {}" , master .getServerName ());
136-       while  (!master .isShutDown ()) {
137-         Thread .sleep (200 );
138-       }
136+       TEST_UTIL .waitFor (30000 , () -> !master .isAlive ());
139137      LOG .info ("Shutdown master {}" , master .getServerName ());
140-       while  (cluster .getMaster () == null  || !cluster .getMaster ().isInitialized ()) {
141-         LOG .info ("Get master {}" ,
142-           cluster .getMaster () == null  ? "null"  : cluster .getMaster ().getServerName ());
143-         Thread .sleep (200 );
144-       }
138+       TEST_UTIL .waitFor (30000 ,
139+         () -> cluster .getMaster () != null  && cluster .getMaster ().isInitialized ());
145140      LOG .info ("Got master {}" , cluster .getMaster ().getServerName ());
146141      // confirm client access still works 
147142      assertTrue (admin .balance (BalanceRequest .defaultInstance ()).isBalancerRan ());
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments