dsmiley opened a new pull request, #4934: URL: https://github.com/apache/solr/pull/4934
https://issues.apache.org/jira/browse/SOLR-18474 # Description `SolrClientCache` is a SolrJ class meant for client use, yet Solr uses it server-side for streaming expressions, `/export`, `/graph`, `/sql` and the cross-collection join. Inside Solr its ownership was diffuse: `CoreContainer` held one, and several streams quietly created their own when their `StreamContext` had none. Those instances differ in configuration and none of them knows which cluster is the local one. # Solution Add `InternalSolrClientCache` (in `org.apache.solr.cloud`), the only `SolrClientCache` permitted inside a Solr server: * `ZkController` owns it and closes it. `CoreContainer` no longer holds one. `StreamHandler`, `ExportHandler`, `GraphHandler` and `CrossCollectionJoinQuery` get it from there. * The local cluster's `CloudSolrClient` is created once, reusing the node's HTTP client and its ZooKeeper ACLs. Connections to any other cluster get a separate client and must be permitted by `allowZkHosts` (ZooKeeper) or `allowUrls` (HTTP), via `ZkController.validateSolrConnection`. This replaces the all-or-nothing `solr.cloud.external.enabled` flag from the earlier revision of this branch. * Constructing a plain `SolrClientCache` on a Solr server thread now fails fast, so future server-side code uses the internal one. Client JVMs, including SolrJ applications and `bin/solr stream --execution local`, are unaffected. * Fallouts of that guard, each its own commit: `CloudSolrStream` now creates one cache on the calling thread and shares it with the `SolrStream`s it opens on pool threads, rather than each opening its own; and the Solr JDBC driver can accept a supplied cache. * Cross-collection join now requires SolrCloud. Its `zkHost`/`solrConnection` forms build a `CloudSolrClient`, which standalone should not do; its `solrUrl` form could work locally, but the remote end has to be SolrCloud anyway, and nothing tested it. A note to the dev list asks whether anyone relies on standalone reaching a cluster this way. Developed with AI assistance (Claude Code): merge-conflict resolution against `main`, the validation wiring, and the `CloudSolrStream` cache sharing, all reviewed by me. # Checklist - [x] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability. - [x] I have created a Jira issue and added the issue ID to my pull request title. - [x] I have developed this patch against the `main` branch. - [ ] I have run `./gradlew check`. - [x] I have added tests for my changes. - [x] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide) - [x] I have added a [changelog entry](https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc) for my change 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
