You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by sh...@apache.org on 2025/07/28 10:20:30 UTC

(iotdb) 01/01: fix estimating memory cost for string type

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

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

commit ea622c1a20389ba01946a356841ffa0b5664347c
Author: shuwenwei <s1...@gmail.com>
AuthorDate: Mon Jul 28 18:20:12 2025 +0800

    fix estimating memory cost for string type
---
 .../compaction/selector/estimator/CompactionEstimateUtils.java       | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionEstimateUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionEstimateUtils.java
index f975f0561a5..e706a4edb8d 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionEstimateUtils.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionEstimateUtils.java
@@ -32,6 +32,7 @@ import org.apache.tsfile.file.metadata.ChunkMetadata;
 import org.apache.tsfile.file.metadata.IDeviceID;
 import org.apache.tsfile.file.metadata.MetadataIndexNode;
 import org.apache.tsfile.file.metadata.statistics.BinaryStatistics;
+import org.apache.tsfile.file.metadata.statistics.StringStatistics;
 import org.apache.tsfile.read.TsFileDeviceIterator;
 import org.apache.tsfile.read.TsFileSequenceReader;
 import org.apache.tsfile.utils.Pair;
@@ -112,6 +113,10 @@ public class CompactionEstimateUtils {
                 currentSeriesRamSize +=
                     chunkMetadata.getStatistics().getRetainedSizeInBytes()
                         - BinaryStatistics.INSTANCE_SIZE;
+              } else if (dataType == TSDataType.STRING) {
+                currentSeriesRamSize +=
+                    chunkMetadata.getStatistics().getRetainedSizeInBytes()
+                        - StringStatistics.INSTANCE_SIZE;
               } else {
                 break;
               }