SOLR-7935:fix race that can cause a NPE in openNewSearcher called from an update concurrent with a core reload

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1696417 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2015-08-18 14:04:06 +00:00
parent 3109c453bb
commit bc6a8d9fff
2 changed files with 6 additions and 3 deletions

View File

@ -139,6 +139,9 @@ Bug Fixes
* SOLR-7920: Resolve XSS issue in Admin UI Schema Browser (David Chiu via Upayavira)
* SOLR-7935: Fix very rare race condition that can cause an update to fail
via NullPointerException during a core reload. (yonik)
Optimizations
----------------------

View File

@ -1584,8 +1584,8 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
// SolrCore.verbose("start reopen from",previousSearcher,"writer=",writer);
RefCounted<IndexWriter> writer = getUpdateHandler().getSolrCoreState()
.getIndexWriter(null);
RefCounted<IndexWriter> writer = getSolrCoreState().getIndexWriter(null);
try {
if (writer != null) {
// if in NRT mode, open from the writer
@ -1639,7 +1639,7 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
tmp = new SolrIndexSearcher(this, newIndexDir, getLatestSchema(),
(realtime ? "realtime":"main"), newReader, true, !realtime, true, directoryFactory);
} else {
RefCounted<IndexWriter> writer = getUpdateHandler().getSolrCoreState().getIndexWriter(this);
RefCounted<IndexWriter> writer = getSolrCoreState().getIndexWriter(this);
DirectoryReader newReader = null;
try {
newReader = indexReaderFactory.newReader(writer.get(), this);