-
Notifications
You must be signed in to change notification settings - Fork 857
SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder #4762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
SOLR-18380: remove CloudSolrClient.connect(), ClusterStateProvider.connect() and the legacy Builder #4762
Changes from all commits
df05fdd
2cd81db
3b5df1e
9e4c4f7
096eaa1
39e5598
0ba805b
49f21dd
83a9d2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
| type: removed | ||
| authors: | ||
| - name: Serhiy Bzhezytskyy | ||
| links: | ||
| - name: SOLR-18380 | ||
| url: https://issues.apache.org/jira/browse/SOLR-18380 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,10 +29,8 @@ | |
| import java.time.Duration; | ||
| import java.util.Arrays; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Locale; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.Scanner; | ||
| import java.util.Set; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice comment
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I happen to like the spelling as well ;-). I like to paint my armour using colours ;-) |
||
| try (CloudSolrClient cloudClient = new CloudSolrClient.Builder(zkHost).build()) { | ||
| Set<String> liveNodes = cloudClient.getClusterState().getLiveNodes(); | ||
| int numLiveNodes = (liveNodes != null) ? liveNodes.size() : 0; | ||
| long timeoutNanos = System.nanoTime() + TimeUnit.NANOSECONDS.convert(10, TimeUnit.SECONDS); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,6 @@ | |
| import io.opentelemetry.api.trace.Span; | ||
| import io.opentelemetry.api.trace.Tracer; | ||
| import java.io.IOException; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import org.apache.solr.client.solrj.SolrClient; | ||
| import org.apache.solr.client.solrj.SolrServerException; | ||
| import org.apache.solr.client.solrj.impl.CloudSolrClient; | ||
|
|
@@ -170,11 +168,8 @@ private void assertSameTraceId(LogListener reqLog, String traceId) { | |
| } | ||
|
|
||
| private CloudSolrClient newCloudSolrClient() { | ||
| var builder = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the PR intro implied this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, AI-assisted (Claude Sonnet 5) |
||
| new CloudSolrClient.Builder( | ||
| List.of(cluster.getZkServer().getZkAddress()), Optional.empty()); | ||
| var client = builder.build(); | ||
| client.connect(); | ||
| var client = cluster.newSolrClientBuilder().build(); | ||
| client.getClusterStateProvider().getLiveNodes(); // force the connection now | ||
| return client; | ||
| } | ||
|
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. love it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to share that I sometimes lean in favor of a CHANGELOG -- I think this is a good one CC @janhoy so you notice ;-)