protected void pruneSchemaTemplate(TSPruneSchemaTemplateReq request)
      throws IoTDBConnectionException, StatementExecutionException {
    final TSStatus status =
        callWithRetryAndReconnect(
                () -> {
                  request.setSessionId(sessionId);
                  return client.pruneSchemaTemplate(request);
                })
            .getResult();
    RpcUtils.verifySuccess(status);
  }
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