You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/09/19 18:58:08 UTC

[4/7] lucene-solr:feature/autoscaling: SOLR-11278: Fix race-condition in CDCR submitting a bootstrap call and checking it's status

SOLR-11278: Fix race-condition in CDCR submitting a bootstrap call and checking it's status


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8e12f201
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8e12f201
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8e12f201

Branch: refs/heads/feature/autoscaling
Commit: 8e12f201131d44034efe0cd97dee23df4b16b015
Parents: cec5b41
Author: Varun Thacker <va...@apache.org>
Authored: Tue Sep 19 09:30:07 2017 -0700
Committer: Varun Thacker <va...@apache.org>
Committed: Tue Sep 19 09:30:07 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/solr/handler/CdcrReplicatorManager.java  | 8 ++++++--
 .../src/test/org/apache/solr/cloud/CdcrBootstrapTest.java    | 1 -
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8e12f201/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java b/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java
index 677f5d3..6ef5ebd 100644
--- a/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java
+++ b/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java
@@ -312,7 +312,9 @@ class CdcrReplicatorManager implements CdcrStateManager.CdcrStateObserver {
               timeOut = new TimeOut(BOOTSTRAP_TIMEOUT_SECONDS, TimeUnit.SECONDS); // reset the timer
               retries++;
             }
-          } else if (status == BootstrapStatus.NOTFOUND) {
+          } else if (status == BootstrapStatus.NOTFOUND || status == BootstrapStatus.CANCELLED) {
+            log.info("CDCR bootstrap " + (status == BootstrapStatus.NOTFOUND ? "not found" : "cancelled") + "in {} seconds",
+                BOOTSTRAP_TIMEOUT_SECONDS - timeOut.timeLeft(TimeUnit.SECONDS));
             // the leader of the target shard may have changed and therefore there is no record of the
             // bootstrap process so we must retry the operation
             while (!closed && sendBootstrapCommand() != BootstrapStatus.SUBMITTED)  {
@@ -320,7 +322,9 @@ class CdcrReplicatorManager implements CdcrStateManager.CdcrStateObserver {
             }
             retries = 1;
             timeOut = new TimeOut(6L * 3600L * 3600L, TimeUnit.SECONDS); // reset the timer
-          } else if (status == BootstrapStatus.UNKNOWN) {
+          } else if (status == BootstrapStatus.UNKNOWN || status == BootstrapStatus.SUBMITTED) {
+            log.info("CDCR bootstrap is " + (status == BootstrapStatus.UNKNOWN ? "unknown" : "submitted"),
+                BOOTSTRAP_TIMEOUT_SECONDS - timeOut.timeLeft(TimeUnit.SECONDS));
             // we were not able to query the status on the remote end
             // so just sleep for a bit and try again
             Thread.sleep(BOOTSTRAP_RETRY_DELAY_MS);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8e12f201/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java b/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java
index a5b37d8..6959bd8 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java
@@ -239,7 +239,6 @@ public class CdcrBootstrapTest extends SolrTestCaseJ4 {
     }
   }
 
-  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-11278")
   public void testBootstrapWithContinousIndexingOnSourceCluster() throws Exception {
     // start the target first so that we know its zkhost
     MiniSolrCloudCluster target = new MiniSolrCloudCluster(1, createTempDir("cdcr-target"), buildJettyConfig("/solr"));