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

rong pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 0c9b4a28276 Pipe: Fix tsfile resource deserialize failed (#15052)
0c9b4a28276 is described below

commit 0c9b4a282768e2dbe1818f0291bfcc4d1623192a
Author: Peng Junzhi <[email protected]>
AuthorDate: Mon Mar 10 19:59:15 2025 +0800

    Pipe: Fix tsfile resource deserialize failed (#15052)
---
 .../dataregion/tsfile/TsFileResource.java              | 18 +++++++++++-------
 .../dataregion/tsfile/TsFileResourceBlockType.java     |  3 +++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java
index 725408b7801..0ad3d8c97f2 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java
@@ -272,6 +272,7 @@ public class TsFileResource {
       TsFileResourceBlockType.EMPTY_BLOCK.serialize(outputStream);
     }
 
+    TsFileResourceBlockType.PIPE_MARK.serialize(outputStream);
     ReadWriteIOUtils.write(isGeneratedByPipeConsensus, outputStream);
     ReadWriteIOUtils.write(isGeneratedByPipe, outputStream);
   }
@@ -296,15 +297,18 @@ public class TsFileResource {
       while (inputStream.available() > 0) {
         final TsFileResourceBlockType blockType =
             
TsFileResourceBlockType.deserialize(ReadWriteIOUtils.readByte(inputStream));
-        if (blockType == TsFileResourceBlockType.PROGRESS_INDEX) {
-          maxProgressIndex = ProgressIndexType.deserializeFrom(inputStream);
+        switch (blockType) {
+          case PROGRESS_INDEX:
+            maxProgressIndex = ProgressIndexType.deserializeFrom(inputStream);
+            break;
+          case PIPE_MARK:
+            isGeneratedByPipeConsensus = 
ReadWriteIOUtils.readBoolean(inputStream);
+            isGeneratedByPipe = ReadWriteIOUtils.readBoolean(inputStream);
+            break;
+          default:
+            break;
         }
       }
-
-      if (inputStream.available() > 0) {
-        isGeneratedByPipeConsensus = ReadWriteIOUtils.readBoolean(inputStream);
-        isGeneratedByPipe = ReadWriteIOUtils.readBoolean(inputStream);
-      }
     }
   }
 
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResourceBlockType.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResourceBlockType.java
index a45073a1cc8..7f88f05f130 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResourceBlockType.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResourceBlockType.java
@@ -28,6 +28,7 @@ public enum TsFileResourceBlockType {
   EMPTY_BLOCK((byte) 0),
   PROGRESS_INDEX((byte) 1),
   REMOTE_STORAGE_BLOCK((byte) 2),
+  PIPE_MARK((byte) 3),
   ;
 
   private final byte type;
@@ -46,6 +47,8 @@ public enum TsFileResourceBlockType {
         return EMPTY_BLOCK;
       case 1:
         return PROGRESS_INDEX;
+      case 3:
+        return PIPE_MARK;
       default:
         throw new IllegalArgumentException("Invalid input: " + type);
     }

Reply via email to