mlbiscoc opened a new pull request, #3330:
URL: https://github.com/apache/solr/pull/3330

   Co-authored-by: Luke Kot-Zaniewski <l.kotzaniew...@gmail.com>
   
   https://issues.apache.org/jira/browse/SOLR-17745
   
   # Description
   
   Credit to @kotman12 for helping find this
   
   It appears the optimization in 
[SOLR-14942](https://issues.apache.org/jira/browse/SOLR-14942) never actually 
happens. The reason is the seemingly innocuous check of 
[zkController.isClosed](https://github.com/apache/solr/blob/57de0e8dece2f333a624b6498d139af31d00038c/solr/core/src/java/org/apache/solr/cloud/ZkController.java#L2154)
 which actually ends up always skipping the leader election node cleanup. This 
is not because the ZK session is actually closed but rather a side-effect of 
the complex implementation of 
[SolrZkClient::isClosed](https://github.com/apache/solr/blob/d1498e8d5a7f4382a83a2800a0d1568bcd0f2a55/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java#L852-L854)
 which also checks its "higher level" for closure. The higherLevelIsClosed 
delegates to 
[CoreContainer::isShutDown](https://github.com/apache/solr/blob/6d84e8f97611685df7b39278737ca7bc9fc326d8/solr/core/src/java/org/apache/solr/cloud/ZkController.java#L355)
 which actually gets set to true
  in an [earlier point in the shutdown 
sequence](https://github.com/apache/solr/blob/6d84e8f97611685df7b39278737ca7bc9fc326d8/solr/core/src/java/org/apache/solr/core/CoreContainer.java#L1299-L1308).
 Thus this optimization never materializes.
   
   # Solution
   
   Check SolrZkClient::isConnected instead of isClosed in ZKController. Also 
added a warn level log inside the check.
   
   # Tests
   
   Didn't think a test was necessary for this, but we're happy to add one if 
the community feels it's warranted
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [ ] I have reviewed the guidelines for [How to 
Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my 
code conforms to the standards described there to the best of my ability.
   - [ ] I have created a Jira issue and added the issue ID to my pull request 
title.
   - [ ] I have given Solr maintainers 
[access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
 to contribute to my PR branch. (optional but recommended, not available for 
branches on forks living under an organisation)
   - [ ] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference 
Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)


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

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to