madrob commented on a change in pull request #1071: SOLR-14003: Refactor code 
to avoid reading state from Replica/Slic
URL: https://github.com/apache/lucene-solr/pull/1071#discussion_r399485353
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
 ##########
 @@ -580,7 +580,7 @@ public void publishActiveIfRegisteredAndNotActive(SolrCore 
core) throws Exceptio
         ClusterState clusterState = zkStateReader.getClusterState();
         Replica rep = getReplica(clusterState, collection, 
leaderProps.getStr(ZkStateReader.CORE_NODE_NAME_PROP));
         if (rep == null) return;
-        if (rep.getState() != Replica.State.ACTIVE || 
core.getCoreDescriptor().getCloudDescriptor().getLastPublished() != 
Replica.State.ACTIVE) {
+        if (zkStateReader.getShardStateProvider(collection).getState(rep) != 
Replica.State.ACTIVE || 
core.getCoreDescriptor().getCloudDescriptor().getLastPublished() != 
Replica.State.ACTIVE) {
 
 Review comment:
   Should this be `! isActive(rep)` instead of `getState(rep) != ACTIVE`? 
There's a lot of places where we still call `getState`.

----------------------------------------------------------------
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


With regards,
Apache Git Services

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

Reply via email to