public TSStatus confirmLeader() {
    TSStatus result = new TSStatus();
    if (isLeaderReady()) {
      result.setCode(TSStatusCode.SUCCESS_STATUS.getStatusCode());
    } else {
      result.setCode(TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode());
      if (isLeader()) {
        long startTime = System.currentTimeMillis();
        while (System.currentTimeMillis() - startTime < MAX_WAIT_READY_TIME_MS) {
          if (isLeaderReady()) {
            result.setCode(TSStatusCode.SUCCESS_STATUS.getStatusCode());
            return result;
          }
          try {
            Thread.sleep(RETRY_WAIT_TIME_MS);
          } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            LOGGER.warn("Unexpected interruption during waiting for configNode leader ready.");
            break;
          }
        }
        result.setMessage(
            "The current ConfigNode is leader but not ready yet, please try again later.");
      } else {
        result.setMessage(
            "The current ConfigNode is not leader, please redirect to a new ConfigNode.");
      }
      TConfigNodeLocation leaderLocation = getLeaderLocation();
      if (leaderLocation != null) {
        result.setRedirectNode(leaderLocation.getInternalEndPoint());
      }
    }
    return result;
  }
Confirm the current ConfigNode's leadership.

@return SUCCESS_STATUS if the current ConfigNode is leader and has been ready yet,
    NEED_REDIRECTION otherwise
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java