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 c752d0ce146 Pipe: refine memory cost estimation of Binary types for 
more precise memory control (#15540) (#15612)
c752d0ce146 is described below

commit c752d0ce146e3d148a747a3977bd61878e390c72
Author: Zikun Ma <[email protected]>
AuthorDate: Thu May 29 18:18:47 2025 +0800

    Pipe: refine memory cost estimation of Binary types for more precise memory 
control (#15540) (#15612)
    
    (cherry picked from commit 069354f76b7d0307072667161f936c3505b623a6)
---
 .../db/pipe/resource/memory/PipeMemoryWeightUtil.java  | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryWeightUtil.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryWeightUtil.java
index 78baf1d80ed..d82c26144d6 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryWeightUtil.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryWeightUtil.java
@@ -98,9 +98,10 @@ public class PipeMemoryWeightUtil {
 
         if (tsDataType.isBinary()) {
           final Binary binary = field.getBinaryV();
-          totalSizeInBytes += binary == null ? 0 : binary.getLength();
+          totalSizeInBytes += binary == null ? 8 : binary.ramBytesUsed();
         } else {
-          totalSizeInBytes += tsDataType.getDataTypeSize();
+          totalSizeInBytes +=
+              
roundUpToMultiple(TsPrimitiveType.getByType(tsDataType).getSize() + 8, 8);
         }
       }
     }
@@ -134,18 +135,18 @@ public class PipeMemoryWeightUtil {
 
           if (primitiveType.getDataType().isBinary()) {
             final Binary binary = primitiveType.getBinary();
-            totalSizeInBytes += binary == null ? 0 : binary.getLength();
+            totalSizeInBytes += binary == null ? 8 : binary.ramBytesUsed();
           } else {
-            totalSizeInBytes += primitiveType.getDataType().getDataTypeSize();
+            totalSizeInBytes += roundUpToMultiple(primitiveType.getSize() + 8, 
8);
           }
         }
       } else {
         schemaCount = 1;
         if (type.isBinary()) {
           final Binary binary = batchData.getBinary();
-          totalSizeInBytes += binary == null ? 0 : binary.getLength();
+          totalSizeInBytes += binary == null ? 8 : binary.ramBytesUsed();
         } else {
-          totalSizeInBytes += type.getDataTypeSize();
+          totalSizeInBytes += 
roundUpToMultiple(TsPrimitiveType.getByType(type).getSize() + 8, 8);
         }
       }
     }
@@ -225,11 +226,10 @@ public class PipeMemoryWeightUtil {
             continue;
           }
           for (Binary value : values) {
-            totalSizeInBytes +=
-                value == null ? 0 : (value.getLength() == -1 ? 0 : 
value.getLength());
+            totalSizeInBytes += value == null ? 8 : value.ramBytesUsed();
           }
         } else {
-          totalSizeInBytes += (long) tablet.timestamps.length * 
tsDataType.getDataTypeSize();
+          totalSizeInBytes += (long) tablet.getMaxRowNumber() * 
tsDataType.getDataTypeSize();
         }
       }
     }

Reply via email to