static Map<IDeviceID, Long> getDeviceMetadataSizeMapAndCollectMetadataInfo(
      CompactionTsFileReader reader, CompactionTaskMetadataInfo metadataInfo) throws IOException {
    Map<IDeviceID, Long> deviceMetadataSizeMap = new HashMap<>();
    TsFileDeviceIterator deviceIterator = reader.getAllDevicesIteratorWithIsAligned();
    while (deviceIterator.hasNext()) {
      Pair<IDeviceID, Boolean> deviceAlignedPair = deviceIterator.next();
      IDeviceID deviceID = deviceAlignedPair.getLeft();
      boolean isAligned = deviceAlignedPair.getRight();
      metadataInfo.hasAlignedSeries |= isAligned;
      MetadataIndexNode firstMeasurementNodeOfCurrentDevice =
          deviceIterator.getFirstMeasurementNodeOfCurrentDevice();
      long totalTimeseriesMetadataSizeOfCurrentDevice = 0;
      Map<String, Pair<Long, Long>> timeseriesMetadataOffsetByDevice =
          reader.getTimeseriesMetadataOffsetByDevice(firstMeasurementNodeOfCurrentDevice);
      for (Pair<Long, Long> offsetPair : timeseriesMetadataOffsetByDevice.values()) {
        totalTimeseriesMetadataSizeOfCurrentDevice += (offsetPair.right - offsetPair.left);
      }
      deviceMetadataSizeMap.put(deviceID, totalTimeseriesMetadataSizeOfCurrentDevice);
    }
    return deviceMetadataSizeMap;
  }
Get the details of the tsfile, the returned array contains the following elements in sequence:

<p>total chunk num in this tsfile

<p>max chunk num of one timeseries in this tsfile

<p>max aligned series num in one device. If there is no aligned series in this file, then it
turns to be -1.

<p>max chunk num of one device in this tsfile

@throws IOException if io errors occurred
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionEstimateUtils.java