This is an automated email from the ASF dual-hosted git repository.

yschengzi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new ea575bab472 Skip loading Chunk without matched ChunkMetadata (#11376)
ea575bab472 is described below

commit ea575bab4727ee2185615265eea6e700744dd9ff
Author: Haonan <[email protected]>
AuthorDate: Thu Oct 26 10:53:49 2023 +0800

    Skip loading Chunk without matched ChunkMetadata (#11376)
    
    * Skip loading Chunk without matched ChunkMetadata
    
    * aligned timeseries
---
 .../iotdb/db/queryengine/execution/load/TsFileSplitter.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/TsFileSplitter.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/TsFileSplitter.java
index 55c5bc0aa3a..2b95c948e62 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/TsFileSplitter.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/TsFileSplitter.java
@@ -113,6 +113,12 @@ public class TsFileSplitter {
                 ((header.getChunkType() & TsFileConstant.TIME_COLUMN_MASK)
                     == TsFileConstant.TIME_COLUMN_MASK);
             IChunkMetadata chunkMetadata = 
offset2ChunkMetadata.get(chunkOffset - Byte.BYTES);
+            // When loading TsFile with Chunk in data zone but no matched 
ChunkMetadata
+            // at the end of file, this Chunk needs to be skipped.
+            if (chunkMetadata == null) {
+              reader.readChunk(-1, header.getDataSize());
+              break;
+            }
             TTimePartitionSlot timePartitionSlot =
                 
TimePartitionUtils.getTimePartitionSlot(chunkMetadata.getStartTime());
             ChunkData chunkData =
@@ -229,6 +235,12 @@ public class TsFileSplitter {
             chunkOffset = reader.position();
             chunkMetadata = offset2ChunkMetadata.get(chunkOffset - Byte.BYTES);
             header = reader.readChunkHeader(marker);
+            // When loading TsFile with Chunk in data zone but no matched 
ChunkMetadata
+            // at the end of file, this Chunk needs to be skipped.
+            if (chunkMetadata == null) {
+              reader.readChunk(-1, header.getDataSize());
+              break;
+            }
             if (header.getDataSize() == 0) {
               handleEmptyValueChunk(
                   header, pageIndex2ChunkData, chunkMetadata, 
isTimeChunkNeedDecode);

Reply via email to