Skip to content

SOLR-14718: Failed distributed adds keep their own copy of the add command, so the error names the document - #5091

Open
nick-boss-tech wants to merge 5 commits into
apache:mainfrom
nick-boss-tech:solr-14718-submit
Open

nick-boss-tech wants to merge 5 commits into
apache:mainfrom
nick-boss-tech:solr-14718-submit

Conversation

@nick-boss-tech

@nick-boss-tech nick-boss-tech commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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

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

What happens today

A failed distributed add can be reported with its document already cleared.

The javabin loader uses one add command for every document in a request. It clears that command after each document (JavabinLoader.java#L105-L123). A distributed add queues its request with that same command object (SolrCmdDistributor.java#L241-L264). When the failure is handled, the error still points at the cleared command. The log then prints cmd=add{,id=(null)} (error log, Req.toString).

What this change does

The request keeps its own copy of the add command, so the error still names the document.

  • distribAdd copies the command once per call, before it builds the requests. Each request for each node gets that copy (copy, request).
  • The request body is still built from the loader's command, as before (body).
  • Nothing else changes: what is sent, the retry rules, and the error handling stay the same.

Proof

The regression test fails on the base code and passes with the change.

  • Test class SolrCmdDistributorTest, method test(), which now calls a new check, testFailedAddKeepsItsDocumentWhenTheCommandIsReused. With the copy removed (base production code, this test kept), exactly 1 test fails.
  • With this change: SolrCmdDistributorTest 1/1 passes. Run on 2026-10-07 at head 29c09959791a. The module checks pass.

Limits

With SOLR-5939 in, each request in a failed merged stream is named against its own document.

  • Landing order: SOLR-5939 lands before this change. Without it, a failed merged stream names only one request, the one the client was built with. The SOLR-5939 links in the second and third bullets point at the SOLR-5939 head, f8d4bdbea518, because that code is not on this branch.
  • SOLR-5939 records a failed stream against each request in it, and each request gets its own retry decision (stream error). This change gives each request the copy of its own document's command, so the error names that document (copy).
  • Two paths still name one request. A stream that reports none of its members names only the first request in that stream. The Jetty and JDK clients both report their members (Jetty, JDK). An interrupted stream is reported against the request the client was built with (interrupt, runner).
  • Each add request carries one document to one node (body), and each request has its own retry count (retry count, field). For adds, the retry count is per document per node.
  • The ticket also describes a second, separate flaw. A follow-up submission for that flaw is planned.

Changelog: changelog/unreleased/SOLR-14718-distributor-error-reports-its-document.yml

AI assistance

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

@nick-boss-tech
nick-boss-tech marked this pull request as ready for review October 9, 2026 23:26
@nick-boss-tech nick-boss-tech changed the title SOLR-14718: Multiple flaws in tracking which UpdateCommand is associated with a given failure logged by ErrorReportingConcurrentUpdateSolrClient: "cmd=add{,id=(null)}" SOLR-14718: Failed distributed adds keep their own copy of the add command, so the error names the document Oct 9, 2026
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.

1 participant