private void loadModFile(
      File tsFileToLoad, File targetTsFile, boolean deleteOriginFile, TsFileResource tsFileResource)
      throws LoadFileException {
    final File oldModFileToLoad = ModificationFileV1.getNormalMods(tsFileToLoad);
    final File newModFileToLoad = ModificationFile.getExclusiveMods(tsFileToLoad);
    if (oldModFileToLoad.exists()) {
      final File oldTargetModFile = ModificationFileV1.getNormalMods(targetTsFile);
      moveModFile(oldModFileToLoad, oldTargetModFile, deleteOriginFile);
      try {
        tsFileResource.upgradeModFile(upgradeModFileThreadPool);
      } catch (IOException e) {
        throw new LoadFileException(e);
      }
    } else if (newModFileToLoad.exists()) {
      final File newTargetModFile = ModificationFile.getExclusiveMods(targetTsFile);
      moveModFile(newModFileToLoad, newTargetModFile, deleteOriginFile);
    }
    // force update mod file metrics
    tsFileResource.getExclusiveModFile();
  }
Execute the loading process by the type.

@param tsFileResource tsfile resource to be loaded
@param filePartitionId the partition id of the new file
@param deleteOriginFile whether to delete the original file
@return load the file successfully @UsedBy sync module, load external tsfile module.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java