mirror of https://github.com/apache/lucene.git
SOLR-5783: fix mixing caching + non caching searchers, fix multiple registration of same searcher
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1577167 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
44bec7cfe4
commit
2aa5585ede
|
@ -1477,7 +1477,7 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
newestSearcher.incref();
|
||||
return newestSearcher;
|
||||
|
||||
} else if (newestSearcher.get().getSchema() == getLatestSchema()) {
|
||||
} else if (newestSearcher.get().isCachingEnabled() && newestSearcher.get().getSchema() == getLatestSchema()) {
|
||||
// absolutely nothing has changed, can use the same searcher
|
||||
// but log a message about it to minimize confusion
|
||||
|
||||
|
@ -1872,6 +1872,13 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
private void registerSearcher(RefCounted<SolrIndexSearcher> newSearcherHolder) {
|
||||
synchronized (searcherLock) {
|
||||
try {
|
||||
if (_searcher == newSearcherHolder) {
|
||||
// trying to re-register the same searcher... this can now happen when a commit has been done but
|
||||
// there were no changes to the index.
|
||||
newSearcherHolder.decref(); // decref since the caller should have still incref'd (since they didn't know the searcher was the same)
|
||||
return; // still execute the finally block to notify anyone waiting.
|
||||
}
|
||||
|
||||
if (_searcher != null) {
|
||||
_searcher.decref(); // dec refcount for this._searcher
|
||||
_searcher=null;
|
||||
|
|
|
@ -273,6 +273,8 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn
|
|||
numOpens.incrementAndGet();
|
||||
}
|
||||
|
||||
public boolean isCachingEnabled() { return cachingEnabled; }
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue