Apache Solr open-source search software
SOLR-3844: SolrCore reload can fail because it tries to remove the index write lock while already holding it.
Mark Robert Millerd8385729c246
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 83d050027dc..ca1a3b4eca4 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -222,6 +222,9 @@ Bug Fixes(maxOptimizeSegments, softCommit, expungeDeletes) when sending a commit toreplicas. (Andy Laird, Tomas Fernandez Lobbe, Mark Miller)+* SOLR-3844: SolrCore reload can fail because it tries to remove the index+ write lock while already holding it. (Mark Miller)+Other Changes----------------------diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.javaindex 993217d6364..082e7d8f71f 100644--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java@@ -410,7 +410,7 @@ public final class SolrCore implements SolrInfoMBean {// protect via synchronized(SolrCore.class)private static Set<String> dirs = new HashSet<String>();- void initIndex() {+ void initIndex(boolean reload) {try {String indexDir = getNewIndexDir();boolean indexExists = getDirectoryFactory().exists(indexDir);@@ -422,7 +422,7 @@ public final class SolrCore implements SolrInfoMBean {initIndexReaderFactory();- if (indexExists && firstTime) {+ if (indexExists && firstTime && !reload) {// to remove locks, the directory must already exist... so we create it// if it didn't exist already...Directory dir = directoryFactory.get(indexDir, getSolrConfig().indexConfig.lockType);@@ -644,7 +644,7 @@ public final class SolrCore implements SolrInfoMBean {this.isReloaded = true;}- initIndex();+ initIndex(prev != null);initWriters();initQParsers();