You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2011/10/28 03:07:47 UTC
svn commit: r1190107 - in /lucene/dev/trunk/solr: CHANGES.txt
core/src/java/org/apache/solr/core/SolrCore.java
Author: yonik
Date: Fri Oct 28 01:07:47 2011
New Revision: 1190107
URL: http://svn.apache.org/viewvc?rev=1190107&view=rev
Log:
SOLR-2861: use searcherLock in getIndexDir
Modified:
lucene/dev/trunk/solr/CHANGES.txt
lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java
Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1190107&r1=1190106&r2=1190107&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Fri Oct 28 01:07:47 2011
@@ -401,6 +401,10 @@ Bug Fixes
* SOLR-2791: Replication: abortfetch command is broken if replication was started
by fetchindex command instead of a regular poll (Yury Kats via shalin)
+* SOLR-2861: Fix extremely rare race condition on commit that can result
+ in a NPE (yonik)
+
+
Other Changes
----------------------
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1190107&r1=1190106&r2=1190107&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java Fri Oct 28 01:07:47 2011
@@ -151,10 +151,12 @@ public final class SolrCore implements S
}
public String getIndexDir() {
- if (_searcher == null)
- return dataDir + "index/";
- SolrIndexSearcher searcher = _searcher.get();
- return searcher.getIndexDir() == null ? dataDir + "index/" : searcher.getIndexDir();
+ synchronized (searcherLock) {
+ if (_searcher == null)
+ return dataDir + "index/";
+ SolrIndexSearcher searcher = _searcher.get();
+ return searcher.getIndexDir() == null ? dataDir + "index/" : searcher.getIndexDir();
+ }
}
@@ -945,7 +947,8 @@ public final class SolrCore implements S
// The current searcher used to service queries.
// Don't access this directly!!!! use getSearcher() to
- // get it (and it will increment the ref count at the same time)
+ // get it (and it will increment the ref count at the same time).
+ // This reference is protected by searcherLock.
private RefCounted<SolrIndexSearcher> _searcher;
// All of the open searchers. Don't access this directly.