You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/04/18 01:40:57 UTC

lucene-solr:branch_7x: SOLR-12187: ZkStateReader.Notification thread should only catch Exception

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 367e6d85b -> 864b8d1f8


SOLR-12187: ZkStateReader.Notification thread should only catch Exception


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

Branch: refs/heads/branch_7x
Commit: 864b8d1f85f64cb8b5057a7838d45c3d693aa757
Parents: 367e6d8
Author: Cao Manh Dat <da...@apache.org>
Authored: Wed Apr 18 08:40:06 2018 +0700
Committer: Cao Manh Dat <da...@apache.org>
Committed: Wed Apr 18 08:40:39 2018 +0700

----------------------------------------------------------------------
 .../src/test/org/apache/solr/cloud/DeleteReplicaTest.java | 10 ++++++----
 .../java/org/apache/solr/common/cloud/ZkStateReader.java  |  4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/864b8d1f/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
index 8c11713..08e9a37 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
@@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Supplier;
 
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
@@ -309,16 +310,17 @@ public class DeleteReplicaTest extends SolrCloudTestCase {
       ZkContainer.testing_beforeRegisterInZk = null;
     }
 
-    while (true) {
+    TimeOut timeOut = new TimeOut(30, TimeUnit.SECONDS, TimeSource.NANO_TIME);
+    timeOut.waitFor("Timeout adding replica to shard", () -> {
       try {
         CollectionAdminRequest.addReplicaToShard(collectionName, "shard1")
             .process(cluster.getSolrClient());
-        break;
+        return true;
       } catch (Exception e) {
         // expected, when the node is not fully started
-        Thread.sleep(500);
+        return false;
       }
-    }
+    });
     waitForState("Expected 1x2 collections", collectionName, clusterShape(1, 2));
 
     String leaderJettyNodeName = leaderJetty.getNodeName();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/864b8d1f/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index a73e4c1..cfae849 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -1626,8 +1626,8 @@ public class ZkStateReader implements Closeable {
           if (watcher.onStateChanged(liveNodes, collectionState)) {
             removeCollectionStateWatcher(collection, watcher);
           }
-        } catch (Throwable throwable) {
-          LOG.warn("Error on calling watcher", throwable);
+        } catch (Exception exception) {
+          LOG.warn("Error on calling watcher", exception);
         }
       }
     }