Skip to content

Commit 64f6052

Browse files
authored
Remove invalid assertion in SearchService (#62675)
This assertion does not always hold because there can be a race between `putReaderContext` and `afterIndexRemoved` when an index is deleted. Closes #62624
1 parent 326286a commit 64f6052

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

server/src/main/java/org/elasticsearch/search/SearchService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@ protected void putReaderContext(ReaderContext context) {
300300
// this is important to ensure store can be cleaned up, in particular if the search is a scroll with a long timeout.
301301
final Index index = context.indexShard().shardId().getIndex();
302302
if (indicesService.hasIndex(index) == false) {
303-
final ReaderContext removed = removeReaderContext(context.id().getId());
304-
assert removed == context;
303+
removeReaderContext(context.id().getId());
305304
throw new IndexNotFoundException(index);
306305
}
307306
}

0 commit comments

Comments
 (0)