Skip to content

Commit

Permalink
HBASE-27160 ClientZKSyncer.deleteDataForClientZkUntilSuccess should b…
Browse files Browse the repository at this point in the history
…reak from the loop when deletion is succeeded (#4579)

Signed-off-by: Bryan Beaudreault <[email protected]>
  • Loading branch information
Apache9 authored Jun 26, 2022
1 parent 42853aa commit d7f6861
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,16 @@ private void deleteDataForClientZkUntilSuccess(String node) throws InterruptedEx
LOG.debug("Delete remote " + node + ", client zk wather: " + clientZkWatcher);
try {
ZKUtil.deleteNode(clientZkWatcher, node);
break;
} catch (KeeperException e) {
if (e.code() == KeeperException.Code.NONODE) {
LOG.debug("Node is already deleted, give up", e);
break;
}
LOG.debug("Failed to delete node from client ZK, will retry later", e);
if (e.code() == KeeperException.Code.SESSIONEXPIRED) {
reconnectAfterExpiration();
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,10 @@ public void testMasterSwitch() throws Exception {
HMaster master = cluster.getMaster();
master.stopMaster();
LOG.info("Stopped master {}", master.getServerName());
while (master.isAlive()) {
Thread.sleep(200);
}
TEST_UTIL.waitFor(30000, () -> !master.isAlive());
LOG.info("Shutdown master {}", master.getServerName());
while (cluster.getMaster() == null || !cluster.getMaster().isInitialized()) {
LOG.info("Get master {}",
cluster.getMaster() == null ? "null" : cluster.getMaster().getServerName());
Thread.sleep(200);
}
TEST_UTIL.waitFor(30000,
() -> cluster.getMaster() != null && cluster.getMaster().isInitialized());
LOG.info("Got master {}", cluster.getMaster().getServerName());
// confirm client access still works
assertTrue(admin.balance(BalanceRequest.defaultInstance()).isBalancerRan());
Expand Down

0 comments on commit d7f6861

Please sign in to comment.