From 5fab6e592873d60fd0e5eee258d00679a2ea35bb Mon Sep 17 00:00:00 2001 From: shuwenwei Date: Fri, 2 Feb 2024 09:55:38 +0800 Subject: [PATCH] separate the synchronized block of AbstractCompactionEstimator file info cache --- .../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 d0313d1de6ab..dd3e3a263098 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 @@ private FileInfo getFileInfoFromCache(TsFileResource resource) throws IOExceptio 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; } }