Apache Lucene open-source search software
SOLR-9470: Index replication interactions with IndexWriter can cause deadlock.
markrmillerce22c2697c13
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex be205a4ae3c..b0b08e89441 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -156,6 +156,8 @@ Bug Fixesat a node before its local state had updated with the new collection data(Alan Woodward)+* SOLR-9470: Index replication interactions with IndexWriter can cause deadlock. (Xunlong via Mark Miller)+Optimizations----------------------diff --git a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.javaindex e38f72268fa..b9d9f514bdc 100644--- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java+++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java@@ -436,11 +436,15 @@ public class IndexFetcher {} finally {writer.decref();}- solrCore.getUpdateHandler().getSolrCoreState().closeIndexWriter(solrCore, true);}boolean reloadCore = false;try {+ // we have to be careful and do this after we know isFullCopyNeeded won't be flipped+ if (!isFullCopyNeeded) {+ solrCore.getUpdateHandler().getSolrCoreState().closeIndexWriter(solrCore, true);+ }+LOG.info("Starting download (fullCopy={}) to {}", isFullCopyNeeded, tmpIndexDir);successfulInstall = false;