Skip to content

Reference managed MultiReader #14486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

vigyasharma
Copy link
Contributor

Going by #13976 and this dated stack overflow thread, it seems like there is desire for a reference managed MultiReader.

The implementation should provide a way to safely share a multi-reader across multiple threads, refresh underlying sub-readers periodically to pick new changes, and ensure that sub-readers are not closed until all threads have finished using them. I hacked together a quick prototype based on my understanding of the requirements. If this seems useful, I can add some tests and refine it. Or, @Shibi-bala, since you wrote the initial PR, feel free to take this further if you like.

Following discussions from the PR, this manager exposes a Multi-Reader and expects users to create their own IndexSearcher on top of it. The managed multi-reader uses DirectoryReader.openIfChanged to refresh its sub-readers, and as such, requires its sub-readers to be DirectoryReader instances. I'm not sure if there are non DirectoryReader implementations that we want to handle via this manager.

This manager will increase / decrease refCount for each subReader on acquire and release. acquire will fail if refCount cannot be incremented for any of the subReaders, i.e. if any of the sub-readers have closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant