public TSStatus unsetTTL(String[] nodes) {
    int start = nodes[0].equals("root") ? 1 : 0;
    if (nodes.length <= start) {
      return new TSStatus(TSStatusCode.ILLEGAL_PATH.getStatusCode())
          .setMessage(String.join(IoTDBConstant.PATH_SEPARATOR + "", nodes));
    } else if (nodes.length == start + 1) {
      // if path equals to root.**, then unset it to configured ttl
      if (nodes[0].equals(IoTDBConstant.PATH_ROOT)
          && nodes[1].equals(IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD)) {
        ttlCacheTree.getChild(IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD).ttl = Long.MAX_VALUE;
        return StatusUtils.OK;
      }
    }
    CacheNode current = ttlCacheTree;
    int index = 0;
    boolean hasNonDefaultTTL;
    CacheNode parentOfSubPathToBeRemoved = null;
    for (int i = start; i < nodes.length; i++) {
      hasNonDefaultTTL = !current.getChildren().isEmpty() || current.ttl != NULL_TTL;
      CacheNode child = current.getChild(nodes[i]);
      if (child == null) {
        // there is no matching path on ttl cache tree
        return new TSStatus(TSStatusCode.PATH_NOT_EXIST.getStatusCode())
            .setMessage(
                "Not TTL rule"
                    + " set for "
                    + String.join(IoTDBConstant.PATH_SEPARATOR + "", nodes));
      }
      if (hasNonDefaultTTL) {
        parentOfSubPathToBeRemoved = current;
        index = i;
      }
      current = child;
    }
    // currently, current node is the leaf node of the path to be removed
    if (current.ttl != NULL_TTL) {
      ttlCount--;
    }

    if (!current.getChildren().isEmpty()) {
      // node to be removed is internal node, then just reset its ttl
      current.ttl = NULL_TTL;
      return StatusUtils.OK;
    }

    // node to be removed is leaf node, then remove corresponding node of this path from cache tree
    if (parentOfSubPathToBeRemoved != null) {
      parentOfSubPathToBeRemoved.removeChild(nodes[index]);
    }
    return StatusUtils.OK;
  }
Unset ttl and remove all useless nodes whose subtree at them contains no valid ttl. If the path
to be removed is internal node, then just reset its ttl. Else, find the sub path and remove it.

@param nodes path to be removed
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/ttl/TTLCache.java