Skip to content
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

Close old reference manager when using filtering searcher manager #629

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

aprudhomme
Copy link
Contributor

Using the FilteringSegmentInfosSearcherManager requires replacing the reference to the default IndexSearcher ReferenceManager. However, the previous reference manager was not being closed, which leaves a reference to the initial index segment readers.

This branch fixes the issue by closing the old reference manager after it is replaced.

@aprudhomme aprudhomme requested a review from sarthakn7 March 8, 2024 04:12
@@ -121,7 +123,9 @@ public synchronized void start(long primaryGen) throws IOException {
// Swap in a SearcherManager that filters incompatible segment readers during refresh.
// Updating the reference is not thread safe, but since this happens under the object lock
// and before the shard has stared, nothing should access the manager before the swap.
ReferenceManager<IndexSearcher> oldMgr = mgr;
mgr = new FilteringSegmentInfosSearcherManager(getDirectory(), this, mgr, searcherFactory);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears as if FilteringSegmentInfosSearcherManager is using the old reference manager because it's passed in the constructor, but it only gets the current SegmentInfos: ((SegmentInfosSearcherManager) mgr).getCurrentInfos()
Can we change the constructor to accept SegmentInfos and then pass it from here so that it's clear that the old reference manager is not accessed any more?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, SegmentInfosSearcherManager is package private and cannot be used from NRTReplicaNode unless we relocate the class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍

@aprudhomme aprudhomme merged commit 4b7eccc into Yelp:master Mar 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants