← Back to Pull requests

[Ready] SOLR-5939: A failed merged update stream now records its error against each request in the stream #5075

Closed
unknown closed this pull request without merging on Nov 22, 2026 00:18 UTC
View on GitHub
unknown unknown commented on Oct 09, 2026 20:31 UTC
Author

🤖 AI text below 🤖 (posted on behalf of Nick Shanin)

Ready for review, but held as a draft due to the project's open-PR cap; I'll mark it open on request.

https://issues.apache.org/jira/browse/SOLR-5939

What happens today

When a merged stream fails, the error is recorded only against the first request sent to that node.

A streaming client merges queued updates into one request stream. The client is built with the first request sent to its node, and a failed stream is recorded against that request. The distributor then judges retries and failure counts on the wrong request. For example, a delete-by-query that fails in a stream with a retriable add leaves the add with no error record, and the add is not resubmitted.

What this change does

Each request in a failed stream gets its own error, and a successful stream forgets its requests.

  • The streaming clients report each update they write into a stream. The Jetty and JDK clients both do this (ConcurrentUpdateJettySolrClient.java, ConcurrentUpdateJdkSolrClient.java), through recordStreamedUpdate (ConcurrentUpdateBaseSolrClient.java).

  • A failed stream calls a new handleError callback with its requests. The Solr client records one error per request, and the errors share the exception (StreamingSolrClients.java).

  • A successful stream removes its requests from the lookup map (StreamingSolrClients.java). The map is new in this change (L59-L60), and a request enters it when it is handed to a client (L78).

  • In the tolerant update path, each distinct remote exception is counted once, even when several errors share it (TolerantUpdateProcessor.java).

  • Three SolrJ additions, and no existing SolrJ signature changes: protected final recordStreamedUpdate(Update) (L268-L273), protected handleError(Throwable, List<UpdateRequest>, List<String>, String) (L675-L678), and public onSuccess(Object, InputStream, List<UpdateRequest>) (L724-L727). The last two delegate to the older methods by default.
  • A choice to check

    Per-request attribution is a design choice. Maintainers should judge it.

    The server returns one response for the whole stream, so the client cannot tell which update it rejected. This branch records the failure once per request in the stream, sharing the exception. Two other routes were considered:

  • Pass per-document identity through the callback, so an error names the document the server rejected. This needs server-side changes, or one request per send, which gives up stream merging.

  • Fail the whole batch, with one error and no per-request retry decision. Simpler, but coarser.
  • Was per-request attribution the right middle call?

    Proof

    The focused tests pass with SOLR-5754 combined in, and the new error-attribution tests fail on base production.

  • The combined run (verified 2026-10-08) passed 26 of 26 focused tests on a local merge commit of this head with SOLR-5754 at 7fbe0128d8b0. The merge commit is 1ddbf36202d, and its tree is f2e33340f0ea. This head f8d4bdbea518 is the current head and the head the combined run tested. The current SOLR-5754 head 46b919e2d4e8 only removes a root file. The 26 tests are:

  • - StreamingSolrClientsErrorAttributionTest 2 of 2
    - SolrCmdDistributorTest 1 of 1
    - TestTolerantUpdateProcessorCloud 19 of 19
    - TestTolerantUpdateProcessorRandomCloud 2 of 2
    - StreamingSolrClientsTest 2 of 2. This class comes from SOLR-5754 and is not in this branch alone.
  • StreamingSolrClientsErrorAttributionTest has two tests. testMergedStreamErrorIsAttributedToEveryRequestInTheStream expects error document ids 1 and 2. testDeleteByQueryRetryRuleIsJudgedOnItsOwnRequest expects two errors. On base production, this class fails 2 of 2.
  • Limits

    Several effects of this change are stated here, not narrowed.

  • Client-visible text: a failed merged stream now has one entry per request in it. DistributedUpdatesAsyncException lists each entry's message, so the same message can repeat (DistributedUpdateProcessor.java).

  • Failure accounting: when a stream fails and the retry rule says no, each request in the stream is recorded as failed, not only the first (StreamingSolrClients.java). Requests that were fine can be recorded as failed and can appear in the client's error list.

  • Retries: within a failed stream, each request gets its own retry decision. A request that would have succeeded on its own can be resent.

  • Success credit is unchanged. A successful merged stream still credits only the request the client was built with.

  • A stream implementation that does not report its members names only the first request in that stream.

  • The tolerant-path change has no new test in this branch. A follow-up submission is planned to add one.

  • The registry release is checked by reading. No test measures memory use. A follow-up submission is planned to add a memory check.

  • The proof run used the merged tree with SOLR-5754, not this branch alone.
  • Changelog: changelog/unreleased/SOLR-5939.yml (type: fixed).

    AI assistance

    AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: sarkaramrit1993 Review duration: 62147m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5075"
    general weight: 0.35
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%
    Repository