You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/12/08 22:18:32 UTC
[GitHub] [lucene-solr] tflobbe commented on a change in pull request #2120: SOLR-15029 More gracefully give up shard leadership
tflobbe commented on a change in pull request #2120:
URL: https://github.com/apache/lucene-solr/pull/2120#discussion_r538843558
##########
File path: solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
##########
@@ -1306,7 +1306,7 @@ private static void forceLeaderElection(SolrQueryRequest req, CollectionsHandler
try (ZkShardTerms zkShardTerms = new ZkShardTerms(collectionName, slice.getName(), zkController.getZkClient())) {
// if an active replica is the leader, then all is fine already
Replica leader = slice.getLeader();
- if (leader != null && leader.getState() == State.ACTIVE) {
+ if (leader != null && leader.getState() == State.ACTIVE && zkShardTerms.getHighestTerm() == zkShardTerms.getTerm(leader.getName())) {
Review comment:
I know this is not new code, but should we change `leader.getState() == State.ACTIVE` to `leader.isActive(liveNodes)`?
##########
File path: solr/core/src/java/org/apache/solr/util/TestInjection.java
##########
@@ -337,6 +342,39 @@ public static boolean injectFailUpdateRequests() {
return true;
}
+
+ public static boolean injectLeaderTragedy(SolrCore core) {
Review comment:
What's the point of the return value?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org