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

jt2594838 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 910e0ae9e87 [Pipe] Release tablet memory before closing TsFile scan 
parser (#18350) (#18354)
910e0ae9e87 is described below

commit 910e0ae9e876949e7c44e3cf69b382673e40f250
Author: Caideyipi <[email protected]>
AuthorDate: Thu Jul 30 10:53:55 2026 +0800

    [Pipe] Release tablet memory before closing TsFile scan parser (#18350) 
(#18354)
    
    (cherry picked from commit a6ac4cba687a98a1dbc0babe72f590da9ce9be8f)
---
 .../container/scan/TsFileInsertionScanDataContainer.java       |  5 ++++-
 .../iotdb/db/pipe/event/TsFileInsertionDataContainerTest.java  | 10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/container/scan/TsFileInsertionScanDataContainer.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/container/scan/TsFileInsertionScanDataContainer.java
index 7322a29604f..17d11c7ee7a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/container/scan/TsFileInsertionScanDataContainer.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/container/scan/TsFileInsertionScanDataContainer.java
@@ -160,6 +160,9 @@ public class TsFileInsertionScanDataContainer extends 
TsFileInsertionDataContain
       tsFileSequenceReader.position((long) 
TSFileConfig.MAGIC_STRING.getBytes().length + 1);
 
       prepareData();
+      if (Objects.isNull(chunkReader)) {
+        close();
+      }
     } catch (final Exception e) {
       close();
       throw e;
@@ -390,7 +393,7 @@ public class TsFileInsertionScanDataContainer extends 
TsFileInsertionDataContain
       } while (Objects.nonNull(chunkReader) && 
!chunkReader.hasNextSatisfiedPage());
 
       if (Objects.isNull(chunkReader)) {
-        close();
+        // Let the caller release the last tablet's memory before closing the 
parser.
         break;
       }
 
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/TsFileInsertionDataContainerTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/TsFileInsertionDataContainerTest.java
index ba7d03d74e2..2a2812dd395 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/TsFileInsertionDataContainerTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/TsFileInsertionDataContainerTest.java
@@ -172,6 +172,16 @@ public class TsFileInsertionDataContainerTest {
             null,
             null,
             false)) {
+      replaceAllocatedTabletMemory(
+          container,
+          new PipeMemoryBlock(0) {
+            @Override
+            public void close() {
+              Assert.assertEquals(0, getMemoryUsageInBytes());
+              super.close();
+            }
+          });
+
       final Iterator<TabletInsertionEvent> iterator =
           container.toTabletInsertionEvents().iterator();
 

Reply via email to