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 b807783e97c Pipe: Optimized the floating memory calculation & Fixed 
potential NPE in insertRows privilege checking (#16039) (#18591)
b807783e97c is described below

commit b807783e97cdc3d92b26f71e256597c1f4297757
Author: Caideyipi <[email protected]>
AuthorDate: Tue Sep 8 14:44:33 2026 +0800

    Pipe: Optimized the floating memory calculation & Fixed potential NPE in 
insertRows privilege checking (#16039) (#18591)
    
    * simplify
    
    * comp
    
    * Refactor
    
    * some
    
    * fix-potential-npe
    
    * cache
    
    (cherry picked from commit a4cadf75957e2c9680847f4466f358c1aff3b9f1)
---
 .../tablet/PipeInsertNodeTabletInsertionEvent.java       | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeInsertNodeTabletInsertionEvent.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeInsertNodeTabletInsertionEvent.java
index 84a0f533e23..386b9ebcdf2 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeInsertNodeTabletInsertionEvent.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeInsertNodeTabletInsertionEvent.java
@@ -80,6 +80,7 @@ public class PipeInsertNodeTabletInsertionEvent extends 
EnrichedEvent
   private InsertNode insertNode;
 
   private ProgressIndex progressIndex;
+  private long bytes = Long.MIN_VALUE;
 
   private long extractTime = 0;
 
@@ -433,15 +434,18 @@ public class PipeInsertNodeTabletInsertionEvent extends 
EnrichedEvent
   }
 
   // Notes:
-  // 1. We only consider insertion event's memory for degrade and restart, 
because degrade/restart
-  // may not be of use for releasing other events' memory.
-  // 2. We do not consider eventParsers because they may not exist and if it 
is invoked, the event
+  // 1. We only consider insertion event's memory for degrading, because 
degrading may not be of use
+  // for releasing other events' memory.
+  // 2. We do not consider dataContainers because they may not exist and if it 
is invoked, the event
   // will soon be released.
   @Override
   public long ramBytesUsed() {
-    return INSTANCE_SIZE
-        + (Objects.nonNull(insertNode) ? 
InsertNodeMemoryEstimator.sizeOf(insertNode) : 0)
-        + (Objects.nonNull(progressIndex) ? progressIndex.ramBytesUsed() : 0);
+    return bytes > 0
+        ? bytes
+        : (bytes =
+            INSTANCE_SIZE
+                + (Objects.nonNull(insertNode) ? 
InsertNodeMemoryEstimator.sizeOf(insertNode) : 0)
+                + (Objects.nonNull(progressIndex) ? 
progressIndex.ramBytesUsed() : 0));
   }
 
   /////////////////////////// ReferenceTrackableEvent 
///////////////////////////

Reply via email to