public void UpdateNodeVersion(int nodeID, long version) { currentNodeVersions[nodeID] = version; if (currentShardSearcher != null) { currentShardSearcher.IndexReader.DecRef(); } currentShardSearcher = new ShardIndexSearcher(this, GetCurrentNodeVersions(), Mgr.Acquire().IndexReader, MyNodeID); }
public void InitSearcher(long[] nodeVersions) { if (Debugging.AssertsEnabled) { Debugging.Assert(currentShardSearcher is null); } Array.Copy(nodeVersions, 0, currentNodeVersions, 0, currentNodeVersions.Length); currentShardSearcher = new ShardIndexSearcher(this, GetCurrentNodeVersions(), Mgr.Acquire().IndexReader, MyNodeID); }
// Get the current (fresh) searcher for this node public ShardIndexSearcher Acquire() { while (true) { ShardIndexSearcher s = currentShardSearcher; // In theory the reader could get decRef'd to 0 // before we have a chance to incRef, ie if a reopen // happens right after the above line, this thread // gets stalled, and the old IR is closed. So we // must try/retry until incRef succeeds: if (s.IndexReader.TryIncRef()) { return(s); } } }
public void UpdateNodeVersion(int nodeID, long version) { CurrentNodeVersions[nodeID] = version; if (CurrentShardSearcher != null) { CurrentShardSearcher.IndexReader.DecRef(); } CurrentShardSearcher = new ShardIndexSearcher(this, (long[])CurrentNodeVersions.Clone(), Mgr.Acquire().IndexReader, MyNodeID); }
public void Release(ShardIndexSearcher s) { s.IndexReader.DecRef(); }
public void InitSearcher(long[] nodeVersions) { Debug.Assert(CurrentShardSearcher == null); Array.Copy(nodeVersions, 0, CurrentNodeVersions, 0, CurrentNodeVersions.Length); CurrentShardSearcher = new ShardIndexSearcher(this, (long[])CurrentNodeVersions.Clone(), Mgr.Acquire().IndexReader, MyNodeID); }
public static void Release(ShardIndexSearcher s) // LUCENENET: CA1822: Mark members as static { s.IndexReader.DecRef(); }