You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org> on 2026/08/19 15:23:08 UTC

[PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

serhiy-bzhezytskyy opened a new pull request, #4762:
URL: https://github.com/apache/solr/pull/4762

   Removes `CloudSolrClient.connect()`/`connect(long, TimeUnit)`, `ClusterStateProvider.connect()`, and the legacy `Builder(List<String>, Optional<String>)` — 54 call sites. `connect()` was never substantive in any implementation (one was literally `getLiveNodes();`); callers now call `getClusterStateProvider().getLiveNodes()` directly. `getClusterState()` is left alone, per the ticket's own note that its future is undecided.
   
   Where to look: the `Builder(List, Optional)` → `Builder(String)` swap is not a pure rename — the connection-string parser takes everything after the first `/` as the chroot, which the two-arg form discarded. `RunExampleTool` picks up a real fix from this (its `zkHost` can carry a chroot).
   
   Two risks no compiler would catch, both fixed: a mock returning `null` from `getClusterStateProvider()` turned a passing test into a 150s hang instead of a failure (`SolrMessageProcessorTest`, now stubs the provider); and a broken `var` initializer on one line silently swallowed the compile error on the next (`TestSimplePropagatorDistributedTracing`).
   
   54 call sites, 19 changed test classes (one @Ignore'd abstract base correctly has no tests of its own — its 3 concrete subclasses do), compile + gates clean.
   
   SOLR-18373, SOLR-18378, SOLR-18382 and SOLR-18386 touch files this PR also touches — merging this one first should make those cleaner to extract.
   
   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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3820261772


##########
solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java:
##########
@@ -737,7 +737,7 @@ private void clusterStatusBadCollectionTest() throws Exception {
 
   private void replicaPropTest() throws Exception {
     try (CloudSolrClient client = createCloudClient(null)) {
-      client.connect();
+      client.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Same as the `TestCollectionAPI.java:690` thread -- removed.
   
   AI-assisted (Claude Sonnet 5)



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java:
##########
@@ -1204,7 +1204,7 @@ private void testAliasCreationNameValidation() throws Exception {
 
   private void testShardCreationNameValidation() throws Exception {
     try (CloudSolrClient client = createCloudClient(null)) {
-      client.connect();
+      client.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Same as the `TestCollectionAPI.java:690` thread -- removed.
   
   AI-assisted (Claude Sonnet 5)



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java:
##########
@@ -85,7 +85,7 @@ private void listCollection() throws IOException, SolrServerException {
   private void clusterAssignPropertyTest() throws Exception {
 
     try (CloudSolrClient client = createCloudClient(null)) {
-      client.connect();
+      client.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Same as the `TestCollectionAPI.java:690` thread -- removed.
   
   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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on PR #4762:
URL: https://github.com/apache/solr/pull/4762#issuecomment-5346814027

   @dsmiley you deprecated all of this two months ago (`CloudSolrClient.connect()` x2, the legacy `Builder`, `ClusterStateProvider.connect()`), so it's fresh enough to actually need your take. 54 sites across 5 modules, and migrating them turned up two places where the removal could've silently broken a test (a mock returning null -> 150s hang; a broken `var` swallowing a compile error) -- fixed, but a second pair of eyes from whoever wrote the deprecation would be reassuring.
   
   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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3820535510


##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -673,8 +671,8 @@ protected void runCloudExample(CommandLine cli) throws Exception {
 
   /** wait until the number of live nodes == numNodes. */
   protected void waitToSeeLiveNodes(String zkHost, int numNodes) {
-    try (CloudSolrClient cloudClient =
-        new CloudSolrClient.Builder(List.of(zkHost), Optional.empty()).build()) {
+    // honours a chroot inside zkHost, e.g. zk1:2181/solr

Review Comment:
   I happen to like the spelling as well ;-).    I like to paint my armour using colours ;-)



-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3820255542


##########
solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java:
##########
@@ -687,7 +687,7 @@ private void clusterStatusWithCollectionAndShardJSON() throws IOException, SolrS
 
   private void clusterStatusRolesTest() throws Exception {
     try (CloudSolrClient client = createCloudClient(null)) {
-      client.connect();
+      client.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Confirmed -- `CloudSolrClient.sendRequest()` unconditionally calls `provider.getLiveNodes()` for a request without a collection param, which is what `client.request(...)` sends a few lines later here (and `getClusterState()` in the other spot delegates to the same lazy-init path). So the forcing call was dead weight, not a migration bug -- removed in all 4 spots you flagged, both test classes re-run green.
   
   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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on PR #4762:
URL: https://github.com/apache/solr/pull/4762#issuecomment-5390880666

   Restored `Builder(List<String>, Optional<String>)` -- the other three removals (`connect()` x2, `ClusterStateProvider.connect()`) stand as-is, shipped in 10.0.0.


-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3823673886


##########
solr/core/src/test/org/apache/solr/cloud/CreateRoutedAliasTest.java:
##########
@@ -545,7 +545,7 @@ private void assertFailure(Request req, String expectedErrorSubstring) throws IO
   }
 
   private void assertCollectionExists(String name) {
-    solrClient.getClusterStateProvider().connect(); // TODO get rid of this
+    solrClient.getClusterStateProvider().getLiveNodes(); // TODO get rid of this

Review Comment:
   Done -- removed. `getState(name)` on the next line already forces the same connect, so no hardening was even needed.



-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3822058726


##########
solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java:
##########
@@ -692,6 +692,15 @@ public CloudSolrClient newSolrClient(String collection) {
         .build(); // we choose 90 because we run in some harsh envs
   }
 
+  /**
+   * Returns a new {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} pointed at this
+   * cluster's ZooKeeper ensemble, to customize further (default collection, update routing, HTTP

Review Comment:
   don't overdocument implementations details (AI does this all the time).  This is an implementation detail that I plan to change to pick randomly between the ZK & HTTP ClusterState at some point.



##########
solr/core/src/test/org/apache/solr/cloud/CreateRoutedAliasTest.java:
##########
@@ -545,7 +545,7 @@ private void assertFailure(Request req, String expectedErrorSubstring) throws IO
   }
 
   private void assertCollectionExists(String name) {
-    solrClient.getClusterStateProvider().connect(); // TODO get rid of this
+    solrClient.getClusterStateProvider().getLiveNodes(); // TODO get rid of this

Review Comment:
   Your comment/investigation https://github.com/apache/solr/pull/4762#discussion_r3820874330 nicely confirms you can remove this



##########
solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java:
##########
@@ -692,6 +692,15 @@ public CloudSolrClient newSolrClient(String collection) {
         .build(); // we choose 90 because we run in some harsh envs
   }
 
+  /**
+   * Returns a new {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} pointed at this
+   * cluster's ZooKeeper ensemble, to customize further (default collection, update routing, HTTP
+   * client, ...) before calling {@code build()}.
+   */
+  public CloudSolrClient.Builder getSolrClientBuilder() {

Review Comment:
   rename to `newSolrClientBuilder`; we aren't returning something we already have.



##########
changelog/unreleased/SOLR-18380-remove-cloudsolrclient-connect-and-legacy-builder.yml:
##########


Review Comment:
   Just to share that I sometimes lean in favor of a CHANGELOG -- I think this is a good one  CC @janhoy so you notice ;-)



-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3853381042


##########
changelog/unreleased/SOLR-18380-remove-cloudsolrclient-connect-and-legacy-builder.yml:
##########
@@ -0,0 +1,8 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: Remove the deprecated CloudSolrClient.connect() and connect(long, TimeUnit) methods, ClusterStateProvider.connect(), and the CloudSolrClient.Builder(List, Optional) constructor. Call ClusterStateProvider.getLiveNodes() to force a connection, and build with the connection-string constructor, which also honours a chroot inside the string.

Review Comment:
   whoops; no this does not remove that constructor.



-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on PR #4762:
URL: https://github.com/apache/solr/pull/4762#issuecomment-5382517383

   Can you please confirm if these deprecations landed <= 10.0  If so I can remove in 10.x.


-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4762:
URL: https://github.com/apache/solr/pull/4762#issuecomment-5385663360

   > Can you please confirm if these deprecations landed <= 10.0 If so I can remove in 10.x.
   
   It's listed under the "thing to remove solr 11" jira, because I organized them based on the whole "deprecations last for a major version".   Mostly a FYI, I'm up for seeing deprecated code move away sooner......
   
   @dsmiley do you want to assign this one to yourself and handle the merge (and any backporting)?


-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3817536865


##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -673,8 +671,8 @@ protected void runCloudExample(CommandLine cli) throws Exception {
 
   /** wait until the number of live nodes == numNodes. */
   protected void waitToSeeLiveNodes(String zkHost, int numNodes) {
-    try (CloudSolrClient cloudClient =
-        new CloudSolrClient.Builder(List.of(zkHost), Optional.empty()).build()) {
+    // honours a chroot inside zkHost, e.g. zk1:2181/solr

Review Comment:
   nice comment



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java:
##########
@@ -1204,7 +1204,7 @@ private void testAliasCreationNameValidation() throws Exception {
 
   private void testShardCreationNameValidation() throws Exception {
     try (CloudSolrClient client = createCloudClient(null)) {
-      client.connect();
+      client.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Unnecessary, I presume



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java:
##########
@@ -737,7 +737,7 @@ private void clusterStatusBadCollectionTest() throws Exception {
 
   private void replicaPropTest() throws Exception {
     try (CloudSolrClient client = createCloudClient(null)) {
-      client.connect();
+      client.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Unnecessary, I presume



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java:
##########
@@ -687,7 +687,7 @@ private void clusterStatusWithCollectionAndShardJSON() throws IOException, SolrS
 
   private void clusterStatusRolesTest() throws Exception {
     try (CloudSolrClient client = createCloudClient(null)) {
-      client.connect();
+      client.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Unnecessary, I presume



##########
solr/core/src/test/org/apache/solr/util/tracing/TestSimplePropagatorDistributedTracing.java:
##########
@@ -170,11 +168,9 @@ private void assertSameTraceId(LogListener reqLog, String traceId) {
   }
 
   private CloudSolrClient newCloudSolrClient() {
-    var builder =

Review Comment:
   the PR intro implied this `var` isn't what we think it is.  Isn't it a builder?



##########
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:
   getZkStateReader will do that well enough



##########
solr/core/src/test/org/apache/solr/util/tracing/TestSimplePropagatorDistributedTracing.java:
##########
@@ -170,11 +168,9 @@ private void assertSameTraceId(LogListener reqLog, String traceId) {
   }
 
   private CloudSolrClient newCloudSolrClient() {
-    var builder =
-        new CloudSolrClient.Builder(
-            List.of(cluster.getZkServer().getZkAddress()), Optional.empty());
+    var builder = new CloudSolrClient.Builder(cluster.getZkServer().getZkAddress());

Review Comment:
   I've seen this so many times (and I've got a variant of this wrong before and it bit me) that I feel cluster needs a CSC builder method to make this more idiomatic.  Any way, defer my comment if you wish.



##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java:
##########
@@ -646,7 +646,7 @@ private void testJDBCMethods(
       }
 
       CloudSolrClient solrClient = cluster.getSolrClient();
-      solrClient.connect();
+      solrClient.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Hmm; I suspect this isn't necessary.  I believe obtaining the ZkStateReader itself implies a connection.



##########
solr/core/src/test/org/apache/solr/cloud/OverseerTest.java:
##########
@@ -1808,7 +1808,7 @@ private SolrCloudManager getCloudDataProvider(ZkStateReader zkStateReader) {
     solrClients.add(cloudSolrClient);
     solrClients.add(httpSolrClient);
     SolrClientCloudManager sccm = new SolrClientCloudManager(cloudSolrClient, null);
-    sccm.getClusterStateProvider().connect();
+    sccm.getClusterStateProvider().getLiveNodes();

Review Comment:
   either not needed or deserves a comment as to why it is



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/TestReplicaProperties.java:
##########
@@ -85,7 +85,7 @@ private void listCollection() throws IOException, SolrServerException {
   private void clusterAssignPropertyTest() throws Exception {
 
     try (CloudSolrClient client = createCloudClient(null)) {
-      client.connect();
+      client.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Unnecessary, I presume



##########
solr/core/src/test/org/apache/solr/cloud/CreateRoutedAliasTest.java:
##########
@@ -545,7 +545,7 @@ private void assertFailure(Request req, String expectedErrorSubstring) throws IO
   }
 
   private void assertCollectionExists(String name) {
-    solrClient.getClusterStateProvider().connect(); // TODO get rid of this
+    solrClient.getClusterStateProvider().getLiveNodes(); // TODO get rid of this

Review Comment:
   Note the TODO and the URL.  I believe the objective is to remove this line and, if needed, harden the call chain below to ensure it doesn't NPE if it hasn't yet internally connected.  ~8 years ago Noble argued that's another issue to do (that wasn't done?) but IMO it's so simple so why not commence now.



##########
solr/cross-dc-manager/src/java/org/apache/solr/crossdc/manager/messageprocessor/SolrMessageProcessor.java:
##########
@@ -377,7 +377,8 @@ private void connectToSolrIfNeeded() {
     boolean connected = false;
     while (!connected) {
       try {
-        clientSupplier.get().connect(); // volatile null-check if already connected
+        // a cheap round-trip that fails the same way connect() did

Review Comment:
   let's not speak of a non-existent method



##########
solr/solr-ref-guide/modules/deployment-guide/examples/UsingSolrJRefGuideExamplesTest.java:
##########


Review Comment:
   love it



##########
solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java:
##########
@@ -356,7 +356,7 @@ protected void initCloud() {
     assert (cloudInit == false);
     cloudInit = true;
     cloudClient = createCloudClient(DEFAULT_COLLECTION);
-    cloudClient.connect();
+    cloudClient.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   `ZkStateReader.from` will do that



-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3820637660


##########
solr/cross-dc-manager/src/java/org/apache/solr/crossdc/manager/messageprocessor/SolrMessageProcessor.java:
##########
@@ -377,7 +377,8 @@ private void connectToSolrIfNeeded() {
     boolean connected = false;
     while (!connected) {
       try {
-        clientSupplier.get().connect(); // volatile null-check if already connected
+        // a cheap round-trip that fails the same way connect() did

Review Comment:
   Fixed -- reworded the comment to describe what the line does instead of naming the deleted method.
   
   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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3820872721


##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/sql/JdbcTest.java:
##########
@@ -646,7 +646,7 @@ private void testJDBCMethods(
       }
 
       CloudSolrClient solrClient = cluster.getSolrClient();
-      solrClient.connect();
+      solrClient.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Confirmed -- removed. `ZkStateReader.from(solrClient)` on the very next line forces the same lazy connection, same as the 4 spots you flagged earlier.
   
   AI-assisted (Claude Sonnet 5)



##########
solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java:
##########
@@ -356,7 +356,7 @@ protected void initCloud() {
     assert (cloudInit == false);
     cloudInit = true;
     cloudClient = createCloudClient(DEFAULT_COLLECTION);
-    cloudClient.connect();
+    cloudClient.getClusterStateProvider().getLiveNodes(); // force the connection now

Review Comment:
   Right -- `ZkStateReader.from(cloudClient)` two lines below does exactly that. Removed.
   
   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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3823077090


##########
solr/core/src/test/org/apache/solr/cloud/OverseerTest.java:
##########
@@ -1808,7 +1808,7 @@ private SolrCloudManager getCloudDataProvider(ZkStateReader zkStateReader) {
     solrClients.add(cloudSolrClient);
     solrClients.add(httpSolrClient);
     SolrClientCloudManager sccm = new SolrClientCloudManager(cloudSolrClient, null);
-    sccm.getClusterStateProvider().connect();
+    sccm.getClusterStateProvider().getLiveNodes();

Review Comment:
   Not needed -- the injected `ZkStateReader` constructor stores the reference directly, no lazy connect to force. Removed and verified with all 4 tests that exercise this method.



-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
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, 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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on PR #4762:
URL: https://github.com/apache/solr/pull/4762#issuecomment-5385634654

   `connect()` (both overloads) and `ClusterStateProvider.connect()` shipped in 10.0.0. The `Builder(zkHosts, zkChroot)` constructor is marked `since = "10.1"`, and there's no 10.1.0 tag yet.


-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley merged PR #4762:
URL: https://github.com/apache/solr/pull/4762


-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3855600144


##########
changelog/unreleased/SOLR-18380-remove-cloudsolrclient-connect-and-legacy-builder.yml:
##########
@@ -0,0 +1,8 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: Remove the deprecated CloudSolrClient.connect() and connect(long, TimeUnit) methods, ClusterStateProvider.connect(), and the CloudSolrClient.Builder(List, Optional) constructor. Call ClusterStateProvider.getLiveNodes() to force a connection, and build with the connection-string constructor, which also honours a chroot inside the string.

Review Comment:
   Right -- that constructor was restored during review (deprecated separately, in 10.1, which hasn't shipped yet) but I never updated this changelog text after the revert. Fixed in #4813.



-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on PR #4762:
URL: https://github.com/apache/solr/pull/4762#issuecomment-5386254149

   Something deprecated in 10.1 should not have been lumped in with the older connect() deprecation. Please keep the dedicated ZK builder constructor for now. It has to wait till 11.0. 
    
   I wish Eric's PR that added the deprecation version annotation had landed already because I've been looking for that.


-- 
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-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3820611807


##########
solr/core/src/test/org/apache/solr/util/tracing/TestSimplePropagatorDistributedTracing.java:
##########
@@ -170,11 +168,9 @@ private void assertSameTraceId(LogListener reqLog, String traceId) {
   }
 
   private CloudSolrClient newCloudSolrClient() {
-    var builder =
-        new CloudSolrClient.Builder(
-            List.of(cluster.getZkServer().getZkAddress()), Optional.empty());
+    var builder = new CloudSolrClient.Builder(cluster.getZkServer().getZkAddress());

Review Comment:
   Done as a separate commit -- added `MiniSolrCloudCluster.getSolrClientBuilder()` and migrated all 7 sites hand-rolling `new CloudSolrClient.Builder(cluster.getZkServer().getZkAddress())`. One more site, `ForceLeaderTest`, uses the older `AbstractFullDistribZkTestBase` framework with its own `zkServer` field, not `MiniSolrCloudCluster` -- left that one out.
   
   AI-assisted (Claude Sonnet 5)



##########
solr/core/src/test/org/apache/solr/util/tracing/TestSimplePropagatorDistributedTracing.java:
##########
@@ -170,11 +168,9 @@ private void assertSameTraceId(LogListener reqLog, String traceId) {
   }
 
   private CloudSolrClient newCloudSolrClient() {
-    var builder =

Review Comment:
   Yes, `builder` is a `CloudSolrClient.Builder` -- unambiguous at the source level. The PR description was describing a build-time artifact: reintroduced both removed calls together and confirmed javac reports only the constructor error, silently swallowing the separate `client.connect()` removal error on the next line (its type can't resolve once `builder`'s initializer fails). Not a type-identity issue, just an ambiguous sentence on my part -- sorry.
   
   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: issues-unsubscribe@solr.apache.org

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


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


Re: [PR] SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder [solr]

Posted by "serhiy-bzhezytskyy (via GitHub)" <gi...@apache.org>.
serhiy-bzhezytskyy commented on code in PR #4762:
URL: https://github.com/apache/solr/pull/4762#discussion_r3823075190


##########
solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java:
##########
@@ -692,6 +692,15 @@ public CloudSolrClient newSolrClient(String collection) {
         .build(); // we choose 90 because we run in some harsh envs
   }
 
+  /**
+   * Returns a new {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} pointed at this
+   * cluster's ZooKeeper ensemble, to customize further (default collection, update routing, HTTP
+   * client, ...) before calling {@code build()}.
+   */
+  public CloudSolrClient.Builder getSolrClientBuilder() {

Review Comment:
   Done -- renamed to `newSolrClientBuilder`.



##########
solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java:
##########
@@ -692,6 +692,15 @@ public CloudSolrClient newSolrClient(String collection) {
         .build(); // we choose 90 because we run in some harsh envs
   }
 
+  /**
+   * Returns a new {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} pointed at this
+   * cluster's ZooKeeper ensemble, to customize further (default collection, update routing, HTTP

Review Comment:
   Fair -- trimmed to just what it returns, dropped the customization list.



-- 
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-unsubscribe@solr.apache.org

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


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