public static TsFileResource getInnerCompactionTargetFileResource(
      List<TsFileResource> tsFileResources, boolean sequence)
      throws IOException, DiskSpaceInsufficientException {
    long minTime = Long.MAX_VALUE;
    long maxTime = Long.MIN_VALUE;
    long minVersion = Long.MAX_VALUE;
    long maxVersion = Long.MIN_VALUE;
    long maxInnerMergeCount = Long.MIN_VALUE;
    long maxCrossMergeCount = Long.MIN_VALUE;
    int maxTierLevel = 0;
    for (TsFileResource resource : tsFileResources) {
      TsFileName tsFileName = getTsFileName(resource.getTsFile().getName());
      minTime = Math.min(tsFileName.time, minTime);
      maxTime = Math.max(tsFileName.time, maxTime);
      minVersion = Math.min(tsFileName.version, minVersion);
      maxVersion = Math.max(tsFileName.version, maxVersion);
      maxInnerMergeCount = Math.max(tsFileName.innerCompactionCnt, maxInnerMergeCount);
      maxCrossMergeCount = Math.max(tsFileName.crossCompactionCnt, maxCrossMergeCount);
      maxTierLevel = Math.max(resource.getTierLevel(), maxTierLevel);
    }
    // set target resource to COMPACTING until the end of this task
    TsFileResource resource =
        sequence
            ? new TsFileResource(
                new File(
                    generateNewTsFilePathWithMkdir(
                        sequence,
                        tsFileResources.get(0).getDatabaseName(),
                        tsFileResources.get(0).getDataRegionId(),
                        tsFileResources.get(0).getTimePartition(),
                        minTime,
                        minVersion,
                        (int) maxInnerMergeCount + 1,
                        (int) maxCrossMergeCount,
                        maxTierLevel,
                        IoTDBConstant.INNER_COMPACTION_TMP_FILE_SUFFIX)),
                TsFileResourceStatus.COMPACTING)
            : new TsFileResource(
                new File(
                    generateNewTsFilePathWithMkdir(
                        sequence,
                        tsFileResources.get(0).getDatabaseName(),
                        tsFileResources.get(0).getDataRegionId(),
                        tsFileResources.get(0).getTimePartition(),
                        maxTime,
                        maxVersion,
                        (int) maxInnerMergeCount + 1,
                        (int) maxCrossMergeCount,
                        maxTierLevel,
                        IoTDBConstant.INNER_COMPACTION_TMP_FILE_SUFFIX)),
                TsFileResourceStatus.COMPACTING);
    resource.setSeq(sequence);
    return resource;
  }
Create tmp target file for inner space compaction, in which all source files has only one tmp
target file.

@param tsFileResources
@param sequence
@return tmp target file, which is xxx.target
@throws IOException
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/generator/TsFileNameGenerator.java