HBASE-27160 ClientZKSyncer.deleteDataForClientZkUntilSuccess should break from the loop when deletion is succeeded (#4579)

Signed-off-by: Bryan Beaudreault <bbeaudreault@apache.org>
(cherry picked from commit d7f6861e8d)
This commit is contained in:
Duo Zhang 2022-06-26 15:22:25 +08:00
parent 642ebf8474
commit 9537f07ee5
2 changed files with 8 additions and 9 deletions

View File

@ -196,12 +196,16 @@ public abstract class ClientZKSyncer extends ZKListener {
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();
}
}
}
}

View File

@ -133,15 +133,10 @@ public class TestSeparateClientZKCluster {
HMaster master = cluster.getMaster();
master.stopMaster();
LOG.info("Stopped master {}", master.getServerName());
while (!master.isShutDown()) {
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());