This is an automated email from the ASF dual-hosted git repository. rong pushed a commit to branch fix-load-degrade in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 1e4d550da311b8855cfeeeb6083c77dc6a417786 Author: Steve Yurong Su <[email protected]> AuthorDate: Mon Feb 5 10:38:49 2024 +0800 Load: Trigger last flush time map & tsfile resource degrading after successful load --- .../execution/load/LoadTsFileManager.java | 2 +- .../db/storageengine/dataregion/DataRegion.java | 38 +++++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/LoadTsFileManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/LoadTsFileManager.java index d7a87a3b219..4d2a92aff36 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/LoadTsFileManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/LoadTsFileManager.java @@ -59,7 +59,7 @@ import java.util.concurrent.PriorityBlockingQueue; /** * {@link LoadTsFileManager} is used for dealing with {@link LoadTsFilePieceNode} and {@link * LoadCommand}. This class turn the content of a piece of loading TsFile into a new TsFile. When - * DataNode finish transfer pieces, this class will flush all TsFile and laod them into IoTDB, or + * DataNode finish transfer pieces, this class will flush all TsFile and load them into IoTDB, or * delete all. */ public class LoadTsFileManager { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java index b1398dba938..cd992da338a 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java @@ -2593,10 +2593,40 @@ public class DataRegion implements IDataRegionForQuery { false, newTsFileResource.getTsFile().getName()); - resetLastCacheWhenLoadingTsFile(); // update last cache - updateLastFlushTime(newTsFileResource); // update last flush time - long partitionNum = newTsFileResource.getTimePartition(); - updatePartitionFileVersion(partitionNum, newTsFileResource.getVersion()); + // update last cache + resetLastCacheWhenLoadingTsFile(); + + // help last flush map degrade + if (config.isEnableSeparateData()) { + final DataRegionId dataRegionId = new DataRegionId(Integer.parseInt(this.dataRegionId)); + final long timePartitionId = newTsFileResource.getTimePartition(); + if (!lastFlushTimeMap.checkAndCreateFlushedTimePartition(timePartitionId)) { + TimePartitionManager.getInstance() + .registerTimePartitionInfo( + new TimePartitionInfo( + dataRegionId, + timePartitionId, + false, + Long.MAX_VALUE, + lastFlushTimeMap.getMemSize(timePartitionId))); + } + updateLastFlushTime(newTsFileResource); + TimePartitionManager.getInstance() + .updateAfterFlushing( + dataRegionId, + timePartitionId, + System.currentTimeMillis(), + lastFlushTimeMap.getMemSize(timePartitionId), + false); + } + + // update partition version + updatePartitionFileVersion( + newTsFileResource.getTimePartition(), newTsFileResource.getVersion()); + + // help tsfile resource degrade + TsFileResourceManager.getInstance().registerSealedTsFileResource(newTsFileResource); + logger.info("TsFile {} is successfully loaded in unsequence list.", newFileName); } catch (DiskSpaceInsufficientException e) { logger.error(
