public void keepOrderInsert(TsFileResource tsFileResource, boolean sequence) throws IOException {
    registerTsFileResourceToResourceManager(tsFileResource);
    writeLock("keepOrderInsert");
    try {
      Map<Long, TsFileResourceList> selectedMap = sequence ? sequenceFiles : unsequenceFiles;
      selectedMap
          .computeIfAbsent(tsFileResource.getTimePartition(), o -> new TsFileResourceList())
          .keepOrderInsert(tsFileResource);
      if (tsFileResource.getModFileManagement() == null) {
        tsFileResource.setModFileManagement(
            modFileManagementMap.computeIfAbsent(
                tsFileResource.getTimePartition(), 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