Apache Solr open-source search software
SOLR-6002: CLOSE_LOCK does not need to be static, waitForMerges when DirectUpdateHandler2 closes the IndexWriter, add Greg to CHANGES entry.
Mark Robert Millerb74b88a82368
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex a8c44d4da51..9c8607200a8 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -119,7 +119,7 @@ Bug Fixes* SOLR-6002: Fix a couple of ugly issues around SolrIndexWriter close androllback as well as how SolrIndexWriter manages it's ref counted directory- instance. (Mark Miller)+ instance. (Mark Miller, Gregory Chanan)Other Changes---------------------diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.javaindex 25468ae7308..5338e48edc6 100644--- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java+++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java@@ -786,7 +786,13 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState}}- if (writer != null) writer.close();+ if (writer != null) {+ try {+ writer.waitForMerges();+ } finally {+ writer.close();+ }+ }} finally {solrCoreState.getCommitLock().unlock();diff --git a/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java b/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.javaindex a048a1fb9db..be5a16c7afc 100644--- a/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java+++ b/solr/core/src/java/org/apache/solr/update/SolrIndexWriter.java@@ -49,7 +49,7 @@ public class SolrIndexWriter extends IndexWriter {* System.currentTimeMillis() when commit was called. */public static final String COMMIT_TIME_MSEC_KEY = "commitTimeMSec";- private static final Object CLOSE_LOCK = new Object();+ private final Object CLOSE_LOCK = new Object();String name;private DirectoryFactory directoryFactory;