You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by tf...@apache.org on 2019/02/15 22:51:40 UTC
[lucene-solr] branch master updated: SOLR-13229: Cleanup
replicasMetTragicEvent after all exceptions
This is an automated email from the ASF dual-hosted git repository.
tflobbe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 8ac34c2 SOLR-13229: Cleanup replicasMetTragicEvent after all exceptions
8ac34c2 is described below
commit 8ac34c2d6d105ae342985b2baaa00cc6c5bf4cfd
Author: Tomas Fernandez Lobbe <tf...@apache.org>
AuthorDate: Wed Feb 6 16:43:47 2019 -0800
SOLR-13229: Cleanup replicasMetTragicEvent after all exceptions
---
solr/CHANGES.txt | 2 ++
.../src/java/org/apache/solr/cloud/ZkController.java | 18 ++++++++++++------
.../src/java/org/apache/solr/core/CoreContainer.java | 11 +++++------
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 112d70f..182c006 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -59,6 +59,8 @@ Bug Fixes
* SOLR-12330: 500 error code on json.facet syntax errors (Munendra S N, Mikhail Khludnev)
+* SOLR-13229: Cleanup replicasMetTragicEvent after all types of exception (Tomás Fernández Löbbe)
+
Improvements
----------------------
* SOLR-12999: Index replication could delete segments before downloading segments from master if there is not enough
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index c84ba6b..fda5542 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -628,7 +628,14 @@ public class ZkController implements Closeable {
assert ObjectReleaseTracker.release(this);
}
+ /**
+ * Best effort to give up the leadership of a shard in a core after hitting a tragic exception
+ * @param cd The current core descriptor
+ * @param tragicException The tragic exception from the {@code IndexWriter}
+ */
public void giveupLeadership(CoreDescriptor cd, Throwable tragicException) {
+ assert tragicException != null;
+ assert cd != null;
DocCollection dc = getClusterState().getCollectionOrNull(cd.getCollectionName());
if (dc == null) return;
@@ -666,13 +673,12 @@ public class ZkController implements Closeable {
props.put(ZkStateReader.REPLICA_TYPE, cd.getCloudDescriptor().getReplicaType().name().toUpperCase(Locale.ROOT));
props.put(CoreAdminParams.NODE, getNodeName());
getOverseerCollectionQueue().offer(Utils.toJSON(new ZkNodeProps(props)));
- } catch (KeeperException e) {
- log.info("Met exception on give up leadership for {}", key, e);
- replicasMetTragicEvent.remove(key);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- log.info("Met exception on give up leadership for {}", key, e);
+ } catch (Exception e) {
+ // Exceptions are not bubbled up. giveupLeadership is best effort, and is only called in case of some other
+ // unrecoverable error happened
+ log.error("Met exception on give up leadership for {}", key, e);
replicasMetTragicEvent.remove(key);
+ SolrZkClient.checkInterrupted(e);
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 05a8c79..3dc1bb5 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1867,8 +1867,9 @@ public class CoreContainer {
}
/**
- * @param solrCore te core against which we check if there has been a tragic exception
- * @return whether this solr core has tragic exception
+ * @param solrCore the core against which we check if there has been a tragic exception
+ * @return whether this Solr core has tragic exception
+ * @see org.apache.lucene.index.IndexWriter#getTragicException()
*/
public boolean checkTragicException(SolrCore solrCore) {
Throwable tragicException;
@@ -1879,10 +1880,8 @@ public class CoreContainer {
tragicException = e;
}
- if (tragicException != null) {
- if (isZooKeeperAware()) {
- getZkController().giveupLeadership(solrCore.getCoreDescriptor(), tragicException);
- }
+ if (tragicException != null && isZooKeeperAware()) {
+ getZkController().giveupLeadership(solrCore.getCoreDescriptor(), tragicException);
}
return tragicException != null;