serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3820874330
##########
solr/test-framework/src/java/org/apache/solr/cloud/SolrCloudTestCase.java:
##########
@@ -96,7 +96,8 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
protected static SolrZkClient zkClient() {
ZkStateReader reader = cluster.getZkStateReader();
- if (reader == null) cluster.getSolrClient().connect();
+ // force the ZkStateReader into existence
+ if (reader == null)
cluster.getSolrClient().getClusterStateProvider().getLiveNodes();
Review Comment:
Agreed -- simplified to `cluster.getZkStateReader().getZkClient()`. Verified
`getZkStateReader()` never returns null: 4000 concurrent calls right after
cluster startup, all non-null, and a post-shutdown call throws
`AlreadyClosedException`, never null. Dug into why the null-check existed: in
2017 (SOLR-10278) `getZkStateReader()` was a bare field getter, genuinely
nullable before first connection -- the guard was correct then. SOLR-13393
(2019-04-11) rewrote it into today's lazy-init-or-throw pattern to fix a
ZkStateReader leak on shutdown, closing the null path for good. The guard's
been unreachable ever since -- over 6 years.
AI-assisted (Claude Sonnet 5)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]