Revert NonClosingReaderWrapper cache (#20921) - #21830
Merged
bugmakerrrrrr merged 1 commit intoMay 26, 2026
Merged
Conversation
This reverts commit 07540c1. The cached NonClosingReaderWrapper can be closed through one wrapped searcher and later reused by another wrapped searcher for the same underlying reader. Reusing the closed wrapper can cause AlreadyClosedException when the next caller tries to access its leaves. Signed-off-by: panguixin <panguixin@bytedance.com>
bugmakerrrrrr
requested review from
a team,
Bukhtawar,
andrross,
ashking94,
cwperks,
dbwiddis,
gbbafna,
jed326,
kotwanikunal,
mch2,
msfroh,
owaiskazi19,
reta,
sachinpkale,
saratvemulapalli,
shwetathareja and
sohami
as code owners
May 26, 2026 07:31
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21830 +/- ##
============================================
+ Coverage 73.33% 73.40% +0.06%
- Complexity 75329 75421 +92
============================================
Files 6032 6032
Lines 342355 342365 +10
Branches 49229 49230 +1
============================================
+ Hits 251078 251314 +236
+ Misses 71327 71082 -245
- Partials 19950 19969 +19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kkewwei
approved these changes
May 26, 2026
KhishorekumarBS
pushed a commit
to KhishorekumarBS/OpenSearch
that referenced
this pull request
Jul 3, 2026
This reverts commit 07540c1. The cached NonClosingReaderWrapper can be closed through one wrapped searcher and later reused by another wrapped searcher for the same underlying reader. Reusing the closed wrapper can cause AlreadyClosedException when the next caller tries to access its leaves. Signed-off-by: panguixin <panguixin@bytedance.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This reverts the NonClosingReaderWrapper cache introduced in #20921.
NonClosingReaderWrapper only prevents close() from propagating to the underlying DirectoryReader. The wrapper itself is still a normal IndexReader with its own closed state. Once a wrapped searcher closes the cached NonClosingReaderWrapper, that wrapper becomes closed even though the underlying reader remains open.
If the cache later returns the same NonClosingReaderWrapper for another wrapped searcher, the caller may operate on an already-closed wrapper and hit AlreadyClosedException, for example when accessing leaves(). Therefore the wrapper should remain scoped to a single wrapped searcher instead of being shared from a cache.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.