public void activateTemplateWithoutCheck(
      PartialPath activatePath, int templateId, boolean isAligned) throws MetadataException {
    String[] nodes = activatePath.getNodes();
    ICachedMNode cur = storageGroupMNode;
    ICachedMNode child;
    IDeviceMNode<ICachedMNode> entityMNode;

    try {
      for (int i = levelOfSG + 1; i < nodes.length; i++) {
        child = store.getChild(cur, nodes[i]);
        if (child == null) {
          throw new PathNotExistException(activatePath.getFullPath());
        }
        cur = child;
      }
      if (cur.isDevice()) {
        entityMNode = cur.getAsDeviceMNode();
      } else {
        entityMNode = store.setToEntity(cur);
      }

      store.updateMNode(
          entityMNode.getAsMNode(),
          o -> {
            if (!entityMNode.isAligned()) {
              entityMNode.setAligned(isAligned);
            }
            entityMNode.setUseTemplate(true);
            entityMNode.setSchemaTemplateId(templateId);
          });

      regionStatistics.activateTemplate(templateId);
    } finally {
      unPinPath(cur);
    }
  }
Get node by the path

@return last node in given seriesPath
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java