You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2024/03/05 02:29:40 UTC

(iotdb) 09/22: Revert "Fix concurrent modification exception of compaction worker (#12011)"

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

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

commit c8bd33119402ebf57f76cc2d4caaa848215e622e
Author: HTHou <hh...@outlook.com>
AuthorDate: Tue Mar 5 10:00:56 2024 +0800

    Revert "Fix concurrent modification exception of compaction worker (#12011)"
    
    This reverts commit 035be504296e514358376b112256efeb3dcc2fb5.
---
 .../estimator/AbstractCompactionEstimator.java     | 28 ++++++++++------------
 1 file changed, 12 insertions(+), 16 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..77517edbc08 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
@@ -88,19 +88,17 @@ public abstract class AbstractCompactionEstimator {
       return fileInfoCache.get(resource);
     }
     File file = new File(resource.getTsFilePath());
-    synchronized (globalFileInfoCacheForFailedCompaction) {
-      if (globalFileInfoCacheForFailedCompaction.containsKey(file)) {
-        FileInfo fileInfo = globalFileInfoCacheForFailedCompaction.get(file);
-        fileInfoCache.put(resource, fileInfo);
-        return fileInfo;
-      }
-      try (TsFileSequenceReader reader =
-          new TsFileSequenceReader(resource.getTsFilePath(), true, false)) {
-        FileInfo fileInfo = CompactionEstimateUtils.calculateFileInfo(reader);
-        fileInfoCache.put(resource, fileInfo);
-        globalFileInfoCacheForFailedCompaction.put(file, fileInfo);
-        return fileInfo;
-      }
+    if (globalFileInfoCacheForFailedCompaction.containsKey(file)) {
+      FileInfo fileInfo = globalFileInfoCacheForFailedCompaction.get(file);
+      fileInfoCache.put(resource, fileInfo);
+      return fileInfo;
+    }
+    try (TsFileSequenceReader reader =
+        new TsFileSequenceReader(resource.getTsFilePath(), true, false)) {
+      FileInfo fileInfo = CompactionEstimateUtils.calculateFileInfo(reader);
+      fileInfoCache.put(resource, fileInfo);
+      globalFileInfoCacheForFailedCompaction.put(file, fileInfo);
+      return fileInfo;
     }
   }
 
@@ -171,8 +169,6 @@ public abstract class AbstractCompactionEstimator {
     if (resource == null || resource.getTsFile() == null) {
       return;
     }
-    synchronized (globalFileInfoCacheForFailedCompaction) {
-      globalFileInfoCacheForFailedCompaction.remove(resource.getTsFile());
-    }
+    globalFileInfoCacheForFailedCompaction.remove(resource.getTsFile());
   }
 }