[ 
https://issues.apache.org/jira/browse/SOLR-15705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17433497#comment-17433497
 ] 

Michael Kosten commented on SOLR-15705:
---------------------------------------

Thanks, Ishan. You need to create a compositeId collection with the 
router.field property to see the issue. Using your collection above:

1. Create a new collection with a router field.

{code}
curl --request GET \ 
     --url 
'http://localhost:18983/solr/admin/collections?action=CREATE&name=com1&router.field=route_s&numShards=2'
{code}

 2. Add documents including the router field.

{code}
curl --request POST \
 --url http://localhost:18983/solr/com1/update/json/docs \
 --header 'Content-Type: application/json' \
 --data '{
 "id": "india",
 "route_s": "asia",
 "title_t": "hello how are you"
}'

curl --request POST \
 --url http://localhost:18983/solr/com1/update/json/docs&commit=true \
 --header 'Content-Type: application/json' \
 --data '{
 "id": "france",
 "route_s": "europe",
 "title_t": "very well, thank you"
}'

curl --request GET \
 --url 'http://localhost:18983/solr/com1/update?commit=true'
{code}

3. Query the documents, they should appear on different shards.

{code}
curl --request GET \
 --url 'http://localhost:18983/solr/com1/select?q=*%3A*&fl=id,[shard]'
{code}

4. Delete a document without the _route_ parameter, then query and it's still 
there:

{code}
curl --request GET \
 --url 'http://localhost:18983/solr/com1/update?commit=true' \
 --header 'Content-Type: application/xml' \
 --data '<delete>
 <id>france</id>
</delete>'

curl --request GET \
 --url 'http://localhost:18983/solr/com1/select?q=*%3A*&fl=id,[shard]'
{code}
 

5. Delete the other document without the _route_ parameter and query and it's 
still there:

{code}
curl --request GET \
 --url 'http://localhost:18983/solr/com1/update?commit=true' \
 --header 'Content-Type: application/xml' \
 --data '<delete>
 <id>india</id>
 </delete>'

curl --request GET \
 --url 'http://localhost:18983/solr/com1/select?q=*%3A*&fl=id,[shard]'
{code}

6. Now delete a document with the _route_ parameter, and it's deleted.

{code}
curl --request GET \
 --url 'http://localhost:18983/solr/com1/update?commit=true&_route_=asia' \
 --header 'Content-Type: application/xml' \
 --data '<delete>
 <id>india</id>
 </delete>'

curl --request GET \
 --url 'http://localhost:18983/solr/com1/select?q=*%3A*&fl=id,[shard]'
 {code}
 
 

> Distribute a DeleteById to all shards when using the CompositeId router with 
> a router field defined and field value is missing in request
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-15705
>                 URL: https://issues.apache.org/jira/browse/SOLR-15705
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrCloud
>            Reporter: Michael Kosten
>            Assignee: David Eric Pugh
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> When issuing a DeleteById command for a collection using the CompositeId 
> router with a router field defined and the route value is missing from the 
> request, the DeleteById fails silently, even if it happens to have been sent 
> to the correct shard. Instead of failing silently, the request could be 
> forwarded to all shard leaders and from there to all replicas. Another 
> required change is that the deletion would need to be performed even though 
> the route value is missing. The deletion would be a no-op on the shards where 
> the document does not exist.
> One use case for this feature is when the routing key value is volatile and 
> you need to guarantee no duplicates exist when updating a document if it 
> happens to change shards. Another use case is if you want to delete a 
> document without referencing a database to retrieve the route field value.
> A work-around is to use a DeleteByQuery. However, my testing has found that 
> DeleteById performs significantly better, even when sent to all shards. 
> Additionally, I've found that a heavy mixed load of DeleteByQuery commands 
> and Add commands can lead to node failures when there are multiple replicas.
> Additional comments are in SOLR-6910, however, that JIRA is specific to the 
> implicit router and I mistakenly added them there.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to