public synchronized void delete(String path, int version) throws InterruptedException,
            KeeperException {
        RetryCounter retryCounter = retryCounterFactory.create();
        boolean isRetry = false; // False for first attempt, true for all
        // retries.
        while (true) {
            try {
                zk.delete(path, version);
                return;
            } catch (KeeperException e) {
                ensureConnectivity(e);

                switch (e.code()) {
                    case NONODE:
                        if (isRetry) {
                            logger.info("Node " + path + " already deleted. Assuming that a "
                                    + "previous attempt succeeded.");
                            return;
                        }
                        logger.warn("Node " + path + " already deleted, and this is not a " + "retry");
                        throw e;

                    case CONNECTIONLOSS:
                    case SESSIONEXPIRED:
                    case OPERATIONTIMEOUT:
                        retryOrThrow(retryCounter, e, "delete");
                        break;

                    default:
                        throw e;
                }
            }
            retryCounter.sleepUntilNextRetry();
            retryCounter.useRetry();
            isRetry = true;
        }
    }
delete is an idempotent operation. Retry before throwing exception. This function will not
throw NoNodeException if the path does not exist.
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/common/zookeeper/RecoverableZooKeeper.java