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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to