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

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


The following commit(s) were added to 
refs/heads/addMemoryControlForModEntriesInQuery by this push:
     new 52902afd59e modify compaction
52902afd59e is described below

commit 52902afd59e418d6aacdcd441d3fa1ba3517209e
Author: shuwenwei <[email protected]>
AuthorDate: Mon Aug 11 18:58:01 2025 +0800

    modify compaction
---
 .../compaction/selector/estimator/CompactionEstimateUtils.java        | 4 ++--
 .../dataregion/compaction/selector/estimator/CompactionTaskInfo.java  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

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 e706a4edb8d..13ef96cb6ad 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
@@ -167,7 +167,7 @@ public class CompactionEstimateUtils {
     Map<IDeviceID, Long> deviceMetadataSizeMap = new HashMap<>();
     try {
       for (TsFileResource resource : resources) {
-        cost += resource.getTotalModSizeInByte();
+        cost += CompactionTaskInfo.getMemCostForCachedModEntries(resource);
         try (CompactionTsFileReader reader =
             new CompactionTsFileReader(resource.getTsFilePath(), taskType)) {
           for (Map.Entry<IDeviceID, Long> entry :
@@ -190,7 +190,7 @@ public class CompactionEstimateUtils {
       boolean hasConcurrentSubTask) {
     CompactionTaskMetadataInfo metadataInfo = new CompactionTaskMetadataInfo();
     for (TsFileResource resource : resources) {
-      metadataInfo.metadataMemCost += resource.getTotalModSizeInByte();
+      metadataInfo.metadataMemCost += 
CompactionTaskInfo.getMemCostForCachedModEntries(resource);
       long maxMemToReadAlignedSeries = 
cachedFileInfo.get(resource).maxMemToReadAlignedSeries;
       long maxMemToReadNonAlignedSeries = 
cachedFileInfo.get(resource).maxMemToReadNonAlignedSeries;
       metadataInfo.metadataMemCost +=
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionTaskInfo.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionTaskInfo.java
index f0152f254b0..60ec077ed02 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionTaskInfo.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/CompactionTaskInfo.java
@@ -94,7 +94,7 @@ public class CompactionTaskInfo {
     return resources;
   }
 
-  private long getMemCostForCachedModEntries(TsFileResource tsFileResource) {
+  public static long getMemCostForCachedModEntries(TsFileResource 
tsFileResource) {
     PatternTreeMap<ModEntry, PatternTreeMapFactory.ModsSerializer> 
modifications =
         PatternTreeMapFactory.getModsPatternTreeMap();
     for (ModEntry modification : tsFileResource.getAllModEntries()) {

Reply via email to