public void insertToPartitionFileList(
      TsFileResource tsFileResource, long timePartition, boolean sequence, int insertPos) {
    registerTsFileResourceToResourceManager(tsFileResource);
    writeLock("add");
    try {
      Map<Long, TsFileResourceList> selectedMap = sequence ? sequenceFiles : unsequenceFiles;
      TsFileResourceList tsFileResources =
          selectedMap.computeIfAbsent(timePartition, o -> new TsFileResourceList());
      tsFileResources.set(insertPos, tsFileResource);
      if (tsFileResource.getModFileManagement() == null) {
        tsFileResource.setModFileManagement(
            modFileManagementMap.computeIfAbsent(
                timePartition, t -> new PartitionLevelModFileManager()));
      }
    } finally {
      writeUnlock();
    }
  }
Insert tsFileResource to a target pos(targetPos = insertPos) e.g. if insertPos = 0, then to the
first, if insert Pos = 1, then to the second.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileManager.java