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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2f1dac5900f separate the synchronized block of 
AbstractCompactionEstimator file info cache (#12019)
2f1dac5900f is described below

commit 2f1dac5900f0d95e9ff1b5fda025a64d7838a6da
Author: shuwenwei <[email protected]>
AuthorDate: Fri Feb 2 11:37:21 2024 +0800

    separate the synchronized block of AbstractCompactionEstimator file info 
cache (#12019)
---
 .../selector/estimator/AbstractCompactionEstimator.java      | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/AbstractCompactionEstimator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/AbstractCompactionEstimator.java
index d0313d1de6a..dd3e3a26309 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/AbstractCompactionEstimator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/estimator/AbstractCompactionEstimator.java
@@ -94,13 +94,15 @@ public abstract class AbstractCompactionEstimator {
         fileInfoCache.put(resource, fileInfo);
         return fileInfo;
       }
-      try (TsFileSequenceReader reader =
-          new TsFileSequenceReader(resource.getTsFilePath(), true, false)) {
-        FileInfo fileInfo = CompactionEstimateUtils.calculateFileInfo(reader);
-        fileInfoCache.put(resource, fileInfo);
+    }
+    try (TsFileSequenceReader reader =
+        new TsFileSequenceReader(resource.getTsFilePath(), true, false)) {
+      FileInfo fileInfo = CompactionEstimateUtils.calculateFileInfo(reader);
+      fileInfoCache.put(resource, fileInfo);
+      synchronized (globalFileInfoCacheForFailedCompaction) {
         globalFileInfoCacheForFailedCompaction.put(file, fileInfo);
-        return fileInfo;
       }
+      return fileInfo;
     }
   }
 

Reply via email to