Skip to content

Commit

Permalink
Close old reference manager when using FilteringSegmentInfosSearcherM…
Browse files Browse the repository at this point in the history
…anager
  • Loading branch information
aprudhomme committed Mar 8, 2024
1 parent ff34e3b commit 656e58e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import org.apache.lucene.replicator.nrt.NodeCommunicationException;
import org.apache.lucene.replicator.nrt.ReplicaDeleterManager;
import org.apache.lucene.replicator.nrt.ReplicaNode;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.ReferenceManager;
import org.apache.lucene.search.SearcherFactory;
import org.apache.lucene.store.Directory;
import org.slf4j.Logger;
Expand Down Expand Up @@ -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);
oldMgr.close();
}
}

Expand Down

0 comments on commit 656e58e

Please sign in to comment.