diff --git a/server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java b/server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java index 11b7f752559f0..2d4c322233f7a 100644 --- a/server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java +++ b/server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java @@ -99,6 +99,7 @@ private static FileCachedIndexInput createIndexInput(FileCache fileCache, Stream // This local file cache is ref counted and may not strictly enforce configured capacity. // If we find available capacity is exceeded, deny further BlobFetchRequests. if (fileCache.capacity() < fileCache.usage().usage() + request.getBlobLength() && !fileCache.canOverflow()) { + fileCache.prune(); throw new IOException("Local file cache capacity exceeded - BlobFetchRequest failed: " + request.getFilePath()); } if (Files.exists(request.getFilePath()) == false) {