SOLR-6973: A partial update with no signature fields no longer gets an empty signature, which can delete unrelated documents #5079
This guard is reached only after newInstance(signatureClass, ...) and sig.init(params), so a partial update that contains none of the configured signature fields still constructs and initializes the configured Signature implementation. A custom implementation can perform expensive work or throw from init, which contradicts the stated pass-through behavior; determine that no signature field is present and return to next before constructing/initializing sig.
<!-- ccr-overview-v2 -->
🟡 Changes recommended
Determine whether a signature field is present before constructing and initializing the signature implementation.
<details open>
<summary><strong>1 open finding</strong></summary>
</details>
<details>
<summary><strong>What changed in this PR</strong></summary>
This pull request prevents partial updates without signature fields from generating an empty deduplication signature.
Changes:
| File | Description |
|---|---|
| solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java | Verifies pass-through behavior without a signature or update term. |
| solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java | Skips signature assignment for eligible partial updates. |
| changelog/unreleased/SOLR-6973-signature-partial-update.yml | Documents the fix. |
</details>
🧠 Review effort: Lite
---
💡 <a href="/apache/solr/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
Done.
Approved these changes.
janhoy
nick-boss-tech
🤖 AI text below 🤖 (posted on behalf of Nick Shanin)
https://issues.apache.org/jira/browse/SOLR-6973
What happens today
With
overwriteDupes, a partial update with no signature fields can delete unrelated documents.With a
fieldslist, the processor's loop throws only if a signature field is present in the partial update. A partial update that sets other fields passes the loop with an empty signature. The processor writes that signature tosignatureFieldand setsupdateTermto it (SignatureUpdateProcessorFactory.java).updateDocumentsdeletes every document that matchesupdateTerm(DirectUpdateHandler2.java).What this change does
A partial update with no signature fields skips the signature step.
It goes to the next processor unchanged. Partial updates with a signature field still fail, and requests without
fieldsstill reject partial updates (SignatureUpdateProcessorFactory.java).Behavior change: a partial update that creates a new document now stores it without
signatureField. The old code gave it the shared empty signature, which caused the collision.Proof
The new test fails on the base code and passes with this change.
The test is SignatureUpdateProcessorFactoryTest.java. It checks that
signatureFieldis absent andupdateTermis null. On the base production code, the same class ran 7 tests with 1 failure. The failure is the new test: the base code sets both values it checks for absence.With this change, the focused
SignatureUpdateProcessorFactoryTestran 7 of 7, verified 2026-10-09 at head51fcd05e695. The head includes a review fix that decides the partial-update outcome before the signature class is constructed; the same 7 tests and the same base failure were re-verified at that head. The core module checks also pass.A choice to check
The update passes through. The other option is to reject it.
The no-
fieldssetup already rejects partial updates with an error. This change passes them through, so the update works and no signature is stored. Rejecting would make the failure visible but would stop the update. Was pass-through the right call?Limits
The reporter's 5% symptom is not shown to come from this path.
The ticket comments suggest shard routing. This change removes one collision path. It does not show that the path explains the report. The effect on new documents was checked by reading only. A follow-up submission is planned if the shard-routing path is confirmed as the cause of the reported symptom.
Changelog:
changelog/unreleased/SOLR-6973-signature-partial-update.ymlAI assistance
AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.