SOLR-18335 : SPLITSHARD fails to migrate documents when using a numeric PointField as router.field - #4717
Draft
olivierboudet wants to merge 1 commit into
Conversation
Previously, shard splitting could not utilize numeric point fields as router fields. This change introduces the necessary logic to extract routing values from point fields, either via docValues or stored fields, thus expanding the types of fields available for shard splitting.
olivierboudet
force-pushed
the
jira/SOLR-18335-splitshard-router-field-point-field
branch
from
August 6, 2026 20:11
509d181 to
f5f7b5c
Compare
dsmiley
self-requested a review
August 6, 2026 20:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/SOLR-18335
Description
When executing a SPLITSHARD operation on a collection configured with a custom router.field backed by a numeric PointField (e.g. plong), the operation completes with status: 0 but existing documents are not migrated to the new sub-shards.
Sub-shards are created and set to ACTIVE, but remain empty. The parent shard is marked INACTIVE with all original documents still inside, making them unsearchable.
Collections using the default id field with composite prefix syntax (company_id!doc_id) are not affected.
Solution
A dedicated code path splitPointField() is introduced for PointField route fields. Instead of term enumeration, it reads the routing value per document using:
The routing hash is then computed from this value using HashBasedRouter.sliceHash(), consistent with how documents were originally routed at index time.
An explicit error is thrown if a point-based router.field exposes neither docValues nor stored values, rather than silently producing empty sub-shards.
This implementation and the associated tests were fully generated with AI assistance, and then validated through the external reproducer.
Tests
In addition to the automated Solr tests, I also validated the fix against the minimal external reproducer shared in the bug report:
https://github.com/olivierboudet/solr-splitshard-test/tree/main
With the patch applied,
SPLITSHARDno longer completes with empty sub-shards when the collection uses a custom numericrouter.field. Existing documents are correctly redistributed into the new active sub-shards and remain searchable after the split.Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.