Olivier Boudet created SOLR-18335:
-------------------------------------

             Summary: SPLITSHARD fails to migrate existing documents when using 
custom router.field with compositeId
                 Key: SOLR-18335
                 URL: https://issues.apache.org/jira/browse/SOLR-18335
             Project: Solr
          Issue Type: Bug
          Components: SolrCloud
    Affects Versions: 10.0
            Reporter: Olivier Boudet


When executing a {{SPLITSHARD}} operation on a collection configured with a 
custom routing field ({{{}router.field{}}} in {{{}compositeId{}}}), the 
operation completes almost instantly with {{status: 0}} (success), but existing 
documents are *not copied/migrated* into the new sub-shards.

As a result:
 # New sub-shards are created and set to {{{}active{}}}, but remain empty (0 
documents).

 # Parent shards are marked as {{inactive}} with all original documents still 
residing in them, making these documents unsearchable.

 # Sub-shards only receive newly indexed documents after the split.

 

*Note:* If the collection relies on the default {{id}} field using a prefixed 
syntax ({{{}company_id!doc_id{}}}), {{SPLITSHARD}} works as expected and 
documents are properly split. The issue only occurs when relying explicitly on 
a custom {{router.field}} setting.
h3. Steps to Reproduce
 # Create a collection using {{compositeId}} routing with a custom 
{{{}router.field{}}}:

 ** Collection setting: {{"router":\{"name":"compositeId", 
"field":"company_id"}}}

 ** Schema field definition: {{<field name="company_id" type="plong" 
indexed="true" stored="true"/>}}

 # Index sample documents into the collection

 # Execute a {{SPLITSHARD}} command on one of the active shards

 # Query the collection ({{{}q=*:*{}}})

h3. Expected Result

The parent shard's documents should be properly split and re-indexed into the 
new sub-shards according to their hash ranges, making all pre-existing 
documents searchable in the active sub-shards.
h3. Actual Result

The {{SPLITSHARD}} command returns {{status: 0}} in milliseconds, but the 
sub-shards contain 0 documents. The existing documents remain stuck in the 
{{inactive}} parent shard and are no longer returned in search results.
h3. Minimal Reproducer

A minimal reproduction repository (with minimal schema and execution commands) 
is available here:

[https://github.com/olivierboudet/solr-splitshard-test/tree/main]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to