Skip to content

Commit c4f8e86

Browse files
committed
Change compute to put to prevent unnecessary cache misses
Signed-off-by: Shreyansh Ray <rayshrey@amazon.com>
1 parent bf175e7 commit c4f8e86

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ public IndexInput fetchBlob(BlobFetchRequest blobFetchRequest) throws IOExceptio
7676
return AccessController.doPrivileged((PrivilegedExceptionAction<IndexInput>) () -> {
7777
CachedIndexInput cacheEntry = fileCache.get(key);
7878
if (cacheEntry == null || cacheEntry.isClosed()) {
79-
cacheEntry = fileCache.compute(
80-
key,
81-
(path, cachedIndexInput) -> new DelayedCreationCachedIndexInput(fileCache, streamReader, blobFetchRequest)
82-
);
79+
cacheEntry = fileCache.put(key, new DelayedCreationCachedIndexInput(fileCache, streamReader, blobFetchRequest));
8380
}
8481

8582
// Cache entry was either retrieved from the cache or newly added, either

0 commit comments

Comments
 (0)