protected TSQueryTemplateResp querySchemaTemplate(TSQueryTemplateReq req)
      throws StatementExecutionException, IoTDBConnectionException {
    final TSQueryTemplateResp execResp =
        callWithRetryAndReconnect(
                () -> {
                  req.setSessionId(sessionId);
                  return client.querySchemaTemplate(req);
                },
                TSQueryTemplateResp::getStatus)
            .getResult();
    RpcUtils.verifySuccess(execResp.getStatus());
    return execResp;
  }
reconnect if the remote datanode is unreachable retry if the status is set to needRetry
iotdb-client/session/src/main/java/org/apache/iotdb/session/SessionConnection.java