You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/04/23 17:35:10 UTC

[06/40] lucene-solr:jira/solr-11833: SOLR-12187: ZkStateReader.Notification thread should only catch Exception

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/1d244144
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1d244144
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1d244144

Branch: refs/heads/jira/solr-11833
Commit: 1d2441441be5f5d87103ceeec6d852f8f2f6ba85
Parents: 8c60be4
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:06 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/1d244144/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/1d244144/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);
         }
       }
     }