You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2013/11/21 16:42:38 UTC
svn commit: r1544221 - in /lucene/dev/branches/branch_4x: ./ solr/
solr/CHANGES.txt solr/core/
solr/core/src/java/org/apache/solr/handler/SnapPuller.java
solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
Author: markrmiller
Date: Thu Nov 21 15:42:37 2013
New Revision: 1544221
URL: http://svn.apache.org/r1544221
Log: (empty)
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1544221&r1=1544220&r2=1544221&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Thu Nov 21 15:42:37 2013
@@ -95,6 +95,9 @@ Bug Fixes
* SOLR-5481: SolrCmdDistributor should not let the http client do it's own
retries. (Mark Miller)
+* SOLR-4709: The core reload after replication if config files have changed
+ can fail due to a race condition. (Mark Miller, Hossman))
+
Optimizations
----------------------
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java?rev=1544221&r1=1544220&r2=1544221&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java Thu Nov 21 15:42:37 2013
@@ -57,6 +57,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -416,6 +417,9 @@ public class SnapPuller {
solrCore.getUpdateHandler().getSolrCoreState()
.closeIndexWriter(core, true);
}
+
+ boolean reloadCore = false;
+
try {
LOG.info("Starting download to " + tmpIndexDir + " fullCopy="
+ isFullCopyNeeded);
@@ -450,7 +454,7 @@ public class SnapPuller {
logReplicationTimeAndConfFiles(modifiedConfFiles,
successfulInstall);// write to a file time of replication and
// conf files.
- reloadCore();
+ reloadCore = true;
}
} else {
terminateAndWaitFsyncService();
@@ -470,6 +474,11 @@ public class SnapPuller {
solrCore.getUpdateHandler().getSolrCoreState().openIndexWriter(core);
}
}
+
+ // we must reload the core after we open the IW back up
+ if (reloadCore) {
+ reloadCore();
+ }
if (successfulInstall) {
if (isFullCopyNeeded) {
@@ -699,6 +708,7 @@ public class SnapPuller {
}
private void reloadCore() {
+ final CountDownLatch latch = new CountDownLatch(1);
new Thread() {
@Override
public void run() {
@@ -706,9 +716,17 @@ public class SnapPuller {
solrCore.getCoreDescriptor().getCoreContainer().reload(solrCore.getName());
} catch (Exception e) {
LOG.error("Could not reload core ", e);
+ } finally {
+ latch.countDown();
}
}
}.start();
+ try {
+ latch.await();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new RuntimeException("Interrupted while waiting for core reload to finish", e);
+ }
}
private void downloadConfFiles(List<Map<String, Object>> confFilesToDownload, long latestGeneration) throws Exception {
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1544221&r1=1544220&r2=1544221&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Thu Nov 21 15:42:37 2013
@@ -751,7 +751,7 @@ public class TestReplicationHandler exte
}
- @Test @Ignore("https://issues.apache.org/jira/browse/SOLR-5343")
+ @Test
public void doTestStressReplication() throws Exception {
// change solrconfig on slave
// this has no entry for pollinginterval