From 2b5bb102787e4a7662077aff0af295d65e59ae32 Mon Sep 17 00:00:00 2001 From: Finn Carroll Date: Tue, 27 Aug 2024 08:08:17 +0000 Subject: [PATCH] Delayed cache creation input already counts towards capacity Signed-off-by: Finn Carroll --- .../opensearch/index/store/remote/utils/TransferManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 237062673bf10..991d3af1ce882 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 @@ -97,7 +97,7 @@ private static FileCachedIndexInput createIndexInput(FileCache fileCache, Stream try { // 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()) { + if (fileCache.capacity() < fileCache.usage().usage() && !fileCache.canOverflow()) { fileCache.prune(); throw new IOException("Local file cache capacity exceeded - BlobFetchRequest failed: " + request.getFilePath()); }