← Back to Pull requests

SOLR-18474: InternalSolrClientCache separate from SolrClientCache #4934

Closed
unknown closed this pull request without merging on Sep 25, 2026 02:47 UTC
View on GitHub
unknown unknown commented on Sep 22, 2026 20:56 UTC
Author

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 SolrStreams 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

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.

  • I have created a Jira issue and added the issue ID to my pull request title.

  • I have developed this patch against the main branch.

  • I have run ./gradlew check.

  • I have added tests for my changes.

  • I have added documentation for the Reference Guide

  • I have added a changelog entry for my change
  • 🤖 Generated with Claude Code

    Diff: 369 lines (+276 / -93) across 4 files Reviewer: sigram Review duration: 3230m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 369 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.354
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4934"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.9% · Safe to merge
    16.9%
    Repository