private void onTsFileLoaded(
      TsFileResource newTsFileResource, boolean isFromConsensus, TsFileLastReader lastReader) {
    if (CommonDescriptor.getInstance().getConfig().isLastCacheEnable() && !isFromConsensus) {
      switch (config.getLastCacheLoadStrategy()) {
        case UPDATE:
        case UPDATE_NO_BLOB:
          updateLastCache(newTsFileResource, lastReader);
          break;
        case CLEAN_ALL:
          // The inner cache is shared by TreeDeviceSchemaCacheManager and
          // TableDeviceSchemaCacheManager,
          // so cleaning either of them is enough
          TreeDeviceSchemaCacheManager.getInstance().cleanUp();
          break;
        case CLEAN_DEVICE:
          boolean isTableModel = isTableModelDatabase(databaseName);
          ITimeIndex timeIndex = newTsFileResource.getTimeIndex();
          if (timeIndex instanceof ArrayDeviceTimeIndex) {
            ArrayDeviceTimeIndex deviceTimeIndex = (ArrayDeviceTimeIndex) timeIndex;
            deviceTimeIndex
                .getDevices()
                .forEach(
                    deviceID ->
                        TableDeviceSchemaCache.getInstance()
                            .invalidateLastCache(isTableModel ? databaseName : null, deviceID));
          } else {
            TreeDeviceSchemaCacheManager.getInstance().invalidateDatabaseLastCache(databaseName);
          }
          break;
        default:
          logger.warn(
              "Unrecognized LastCacheLoadStrategy: {}, fall back to CLEAN_ALL",
              IoTDBDescriptor.getInstance().getConfig().getLastCacheLoadStrategy());
          TreeDeviceSchemaCacheManager.getInstance().cleanUp();
          break;
      }
    }
  }
Load a new tsfile to unsequence dir.

<p>Then, update the latestTimeForEachDevice and partitionLatestFlushedTimeForEachDevice.

@param newTsFileResource tsfile resource @UsedBy load external tsfile module
@param deleteOriginFile whether to delete origin tsfile
@param isGeneratedByPipe whether the load tsfile request is generated by pipe
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java