Skip to content

Commit 2ad4593

Browse files
committed
Can check the hint, not the actual instance
1 parent fe92fc8 commit 2ad4593

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/input/CachedBlobContainerIndexInput.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private CachedBlobContainerIndexInput(
102102

103103
@Override
104104
protected void readWithoutBlobCache(ByteBuffer b) throws Exception {
105-
ensureContext(ctx -> ctx != CACHE_WARMING_CONTEXT);
105+
ensureContext(ctx -> ctx.hints().contains(StandardIOBehaviorHint.INSTANCE) == false);
106106
final long position = getAbsolutePosition();
107107
final int length = b.remaining();
108108

@@ -139,7 +139,7 @@ public long getPersistentCacheInitialLength() throws Exception {
139139
* or {@code -1} if the prewarming was cancelled
140140
*/
141141
public long prefetchPart(final int part, Supplier<Boolean> isCancelled) throws IOException {
142-
ensureContext(ctx -> ctx == CACHE_WARMING_CONTEXT);
142+
ensureContext(ctx -> ctx.hints().contains(StandardIOBehaviorHint.INSTANCE));
143143
if (part >= fileInfo.numberOfParts()) {
144144
throw new IllegalArgumentException("Unexpected part number [" + part + "]");
145145
}

0 commit comments

Comments
 (0)