public Set<PartialPath> getDevicesOfPreDeletedTimeseries(PartialPath pathPattern)
      throws MetadataException {
    Set<PartialPath> result = new HashSet<>();
    try (MeasurementCollector<Void, ICachedMNode> collector =
        new MeasurementCollector<Void, ICachedMNode>(
            rootNode, pathPattern, store, false, SchemaConstant.ALL_MATCH_SCOPE) {

          protected Void collectMeasurement(IMeasurementMNode<ICachedMNode> node) {
            if (node.isPreDeleted()) {
              result.add(getPartialPathFromRootToNode(node.getAsMNode()).getDevicePath());
            }
            return null;
          }
        }) {
      collector.traverse();
    }

    return result;
  }
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