You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2025/04/02 03:18:31 UTC

(solr) branch main updated: SOLR-14070 : Deprecate CloudSolrClient's ZKHost constructor (#3298)

This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 4badc70ecfc SOLR-14070 : Deprecate CloudSolrClient's ZKHost constructor (#3298)
4badc70ecfc is described below

commit 4badc70ecfc5cafee94923db9fd848ed279e8eaa
Author: Abhishek Umarjikar <35...@users.noreply.github.com>
AuthorDate: Wed Apr 2 08:48:26 2025 +0530

    SOLR-14070 : Deprecate CloudSolrClient's ZKHost constructor (#3298)
    
    Users should use the other constructor taking Solr URLs (HTTP) instead of communicating with ZK.
---
 solr/CHANGES.txt                                         |  2 ++
 .../modules/deployment-guide/pages/solrj.adoc            | 16 ----------------
 .../upgrade-notes/pages/major-changes-in-solr-10.adoc    |  2 ++
 .../apache/solr/client/solrj/impl/CloudSolrClient.java   |  1 +
 4 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 18d0253172e..322094ab053 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -168,6 +168,8 @@ Other Changes
   To ensure security, Solr should enforce authentication and authorization,
   allowing only authorized admins to publish them. (Abhishek Umarjikar)
 
+* SOLR-14070: Deprecate CloudSolrClient's ZooKeeper Hosts constructor. (Abhishek Umarjikar)
+
 ==================  9.9.0 ==================
 New Features
 ---------------------
diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/solrj.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/solrj.adoc
index 13d69bba824..1a2ad326ab4 100644
--- a/solr/solr-ref-guide/modules/deployment-guide/pages/solrj.adoc
+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/solrj.adoc
@@ -133,22 +133,6 @@ include::example$UsingSolrJRefGuideExamplesTest.java[tag=solrj-cloudsolrclient-b
 ----
 +
 However, unlike other clients, these URLs aren't used to send user-provided requests, but instead serve to fetch information about the layout and health of the Solr cluster.
-If Solr URLs are not known, users may instead specify a list of ZooKeeper hosts (with ports) and ZooKeeper root path, for the `CloudSolrClient` to fetch this information from ZooKeeper directly.
-+
-[source,java,indent=0]
-----
-include::example$UsingSolrJRefGuideExamplesTest.java[tag=solrj-cloudsolrclient-zookeeperroot]
-----
-+
-If no ZooKeeper root path is used then `java.util.Optional.empty()` should be provided.
-+
-[source,java,indent=0]
-----
-include::example$UsingSolrJRefGuideExamplesTest.java[tag=solrj-cloudsolrclient-zookeepernoroot]
-----
-+
-`CloudSolrClient` users who wish to provide ZooKeeper connection information, must depend on the `solr-solrj-zookeeper` artifact to have all of the necessary classes available.
-The ZooKeeper based connection is the most reliable and performant means for CloudSolrClient to work.  On the other hand, it means exposing ZooKeeper more broadly than to Solr nodes, which is a security risk.  It also adds more JAR dependencies.
 
 ==== Default Collections
 
diff --git a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
index 444355bc2f4..113515bdad2 100644
--- a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
+++ b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
@@ -56,6 +56,8 @@ Users who previously relied on collection-specific URLs to avoid including the c
 
 * Minimum Java version for Solrj 10.x is Java 17.
 
+* Deprecate CloudSolrClient’s ZooKeeper Hosts constructor. Users are encouraged to supply Solr URLs instead of communicating with ZooKeeper. It’s not likely to be removed before Solr 11.
+
 === Service installer
 
 The service installer now installs a `systemd` startup script instead of an `init.d` startup script. It is up to the user to uninstall any existing `init.d` script when upgrading.
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
index 43d55fc3739..a0dc29f7196 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
@@ -174,6 +174,7 @@ public abstract class CloudSolrClient extends SolrClient {
      * @param zkChroot the path to the root ZooKeeper node containing Solr data. Provide {@code
      *     java.util.Optional.empty()} if no ZK chroot is used.
      */
+    @Deprecated(since = "10.0")
     public Builder(List<String> zkHosts, Optional<String> zkChroot) {
       super(zkHosts, zkChroot);
     }