Skip to content

Commit

Permalink
separate the synchronized block of AbstractCompactionEstimator file i…
Browse files Browse the repository at this point in the history
…nfo cache (#12019)
  • Loading branch information
shuwenwei authored Feb 2, 2024
1 parent c8419ec commit 2f1dac5
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 2f1dac5

Please sign in to comment.