private boolean isEmptyInternalMNode(ICachedMNode node) throws MetadataException {
    IMNodeIterator<ICachedMNode> iterator = store.getChildrenIterator(node);
    try {
      return !IoTDBConstant.PATH_ROOT.equals(node.getName())
          && !node.isMeasurement()
          && !(node.isDevice() && node.getAsDeviceMNode().isUseTemplate())
          && !iterator.hasNext();
    } finally {
      iterator.close();
    }
  }
Used when delete timeseries or deactivate template. The last survived ancestor will be
unpinned.

@param entityMNode delete empty InternalMNode from entityMNode to storageGroupMNode
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java