Skip to content

SOLR-18243: Refactor solrj-streaming to reuse shared CloudHttp2SolrClient engine#4510

Open
chatzipavlidis wants to merge 1 commit into
apache:mainfrom
chatzipavlidis:refactor-solrj-streaming-cache
Open

SOLR-18243: Refactor solrj-streaming to reuse shared CloudHttp2SolrClient engine#4510
chatzipavlidis wants to merge 1 commit into
apache:mainfrom
chatzipavlidis:refactor-solrj-streaming-cache

Conversation

@chatzipavlidis

Copy link
Copy Markdown

Modifies SolrClientCache.java to extract the underlying, shared HTTP client engine from an active CloudHttp2SolrClient connection pool when provisioning stream target connections. This eliminates the creation of isolated, duplicate legacy HttpSolrClient instances across cluster node lookups in solrj-streaming. Verified via StreamExpressionTest debugging sessions.

…lient. Reuse shared cloud http client engine
@chatzipavlidis chatzipavlidis marked this pull request as ready for review June 8, 2026 17:53

@epugh epugh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a unit test? Seems like that kind of tricky logic that can go bad in the future!

baseUrl,
url -> {
// Find an existing Cloud Client connection
HttpSolrClient sharedEngine = this.httpSolrClient;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe called it sharedClient?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Affirmative 😊

// Find an existing Cloud Client connection
HttpSolrClient sharedEngine = this.httpSolrClient;

if (sharedEngine == null && !cloudSolClients.isEmpty()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was cloudSolClients spelled wrong?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently? Should i refactor it?

@dsmiley

dsmiley commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Sorry, this is not what I meant when I filed SOLR-18243. The idea is that most callers of SolrClientCache.getHttpSolrClient should stop doing so -- instead, get a client from the CloudHttp2SolrClient.getHttpClient() that it had moments ago since in most cases, the URL is in fact derived from a CloudSolrClient shard/replica examination. But this may not quite be doable yet because CloudSolrClient.getHttpClient doesn't exist yet. We're blocked from adding this method until #4451 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants