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 2020/09/07 21:02:35 UTC

[lucene-solr] branch reference_impl_dev updated: @783 We have to manually wait for this still - it seems like we could get this done by ensuring we have the cluster state version that the server for the last async status call has, but then we might hit another not up to date server ...

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new cc1a98b  @783 We have to manually wait for this still - it seems like we could get this done by ensuring we have the cluster state version that the server for the last async status call has, but then we might hit another not up to date server ...
cc1a98b is described below

commit cc1a98becc87dac01149170e6791df75790d8607
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Mon Sep 7 16:01:47 2020 -0500

    @783 We have to manually wait for this still - it seems like we could get this done by ensuring we have the cluster state version that the server for the last async status call has, but then we might hit another not up to date server ...
---
 solr/core/src/test/org/apache/solr/cloud/AddReplicaTest.java        | 6 ++++++
 .../java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/AddReplicaTest.java b/solr/core/src/test/org/apache/solr/cloud/AddReplicaTest.java
index 9e8582b..a7f044a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/AddReplicaTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/AddReplicaTest.java
@@ -210,6 +210,12 @@ public class AddReplicaTest extends SolrCloudTestCase {
       Thread.sleep(100);
     }
     assertTrue(success);
+
+    // we wait for the replicas here - the async addReplica call will carry on in the background
+    // and while it will ensure the server sees the finished state when it's marked complete
+    // that doesn't mean our local cloud client has the state yet
+    cluster.waitForActiveCollection(collection, 2, 4);
+
     // let the client watch fire
     clusterState = cloudClient.getZkStateReader().getClusterState();
     coll = clusterState.getCollection(collection);
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
index e04427f..9eb6e50 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
@@ -1089,6 +1089,8 @@ public abstract class BaseCloudSolrClient extends SolrClient {
       Integer ver = (Integer) resp.get("csver");
       if (ver != null) {
         try {
+          DocCollection coll = getZkStateReader().getClusterState().getCollection(collection);
+          log.info("Wait for catch up to server state {} ours is {}", ver, coll == null ? -1 : coll.getZNodeVersion());
           getZkStateReader().waitForState(collection, 15, TimeUnit.SECONDS, (liveNodes, collectionState) -> {
             if (collectionState != null && collectionState.getZNodeVersion() >= ver) {
               return true;
@@ -1099,7 +1101,7 @@ public abstract class BaseCloudSolrClient extends SolrClient {
           ParWork.propegateInterrupt(e);
           throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
         }
-      } else {
+      } else if (request.getParams().get(CoreAdminParams.ACTION).equals(CollectionParams.CollectionAction.DELETE.toString())) {
         try {
           getZkStateReader().waitForState(collection, 10, TimeUnit.SECONDS, (c) -> c == null);
         } catch (InterruptedException e) {