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/11/09 06:19:40 UTC

[lucene-solr] branch reference_impl_dev updated: @1107 Harden mini cluster collections delete.

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 aac2427  @1107 Harden mini cluster collections delete.
aac2427 is described below

commit aac24270b820611824e188a5ba0b5558fd46e222
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Mon Nov 9 00:19:22 2020 -0600

    @1107 Harden mini cluster collections delete.
---
 .../src/java/org/apache/solr/cloud/LeaderElector.java | 19 ++++++++++++++++++-
 .../org/apache/solr/cloud/MiniSolrCloudCluster.java   |  2 +-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
index d4e7660..f9556d5 100644
--- a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
+++ b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
@@ -119,7 +119,24 @@ public class LeaderElector implements Closeable {
 
     // get all other numbers...
     final String holdElectionPath = context.electionPath + ELECTION_NODE;
-    List<String> seqs = zkClient.getChildren(holdElectionPath, null, true);
+    List<String> seqs;
+    try {
+      seqs = zkClient.getChildren(holdElectionPath, null, true);
+    } catch (KeeperException.SessionExpiredException e) {
+      log.error("ZooKeeper session has expired");
+      throw e;
+    } catch (KeeperException.NoNodeException e) {
+      log.info("the election node disappeared, check if we are the leader again");
+      return true;
+    } catch (KeeperException e) {
+      // we couldn't set our watch for some other reason, retry
+      log.info("Failed setting election watch, retrying {} {}", e.getClass().getName(), e.getMessage());
+      return true;
+    } catch (Exception e) {
+      // we couldn't set our watch for some other reason, retry
+      log.info("Failed on election getchildren call {} {}", e.getClass().getName(), e.getMessage());
+      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
+    }
     sortSeqs(seqs);
 
     String leaderSeqNodeName;
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index 266d241..4643c65 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -616,7 +616,7 @@ public class MiniSolrCloudCluster {
       try {
         CollectionAdminRequest.deleteCollection(collection).process(solrClient);
       } catch (BaseHttpSolrClient.RemoteSolrException e) {
-        if (!e.getMessage().contains("Could not find") && !e.getMessage().contains("Error handling 'UNLOAD' action")) {
+        if (!e.getMessage().contains("Could not find") && !e.getMessage().contains("Error handling 'UNLOAD' action") && !e.getMessage().contains("Cannot unload non-existent core")) {
           errors.put(collection, e);
         }
       } catch (Exception e) {