[ https://issues.apache.org/jira/browse/SOLR-12694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17398960#comment-17398960 ]
Chris M. Hostetter commented on SOLR-12694: ------------------------------------------- FYI: I've incorporated yuki's fixes & tests (after updating to main branch) into the patch in SOLR-8889 and hope to commit soon. > JavaBinUpdateRequestCodec fails to restore UpdateRequest correctly with > implicit routing > ---------------------------------------------------------------------------------------- > > Key: SOLR-12694 > URL: https://issues.apache.org/jira/browse/SOLR-12694 > Project: Solr > Issue Type: Bug > Components: update > Reporter: Yuki Yano > Priority: Major > Attachments: SOLR-12694.patch > > > h1. Overview > As reported in [SOLR-7384|https://issues.apache.org/jira/browse/SOLR-7384], > when send {{deleteById}} request to Solr with {{ImplicitDocRouter}}, Solr > fails to delete the document with the following error. > {quote} > org.apache.solr.common.SolrException: missing \_version\_ on update from > leader > {quote} > This issue is related to > [SOLR-5890|https://issues.apache.org/jira/browse/SOLR-5890], which solved the > issue about deleting documents with the implicit router. Unfortunately, this > change left one bug in {{JavaBinUpdateRequestCodec}} that it forgets to > restore {{version}} during {{unmarshal}} if {{\_route\_}} is set. > {code:java} > Long version = (Long) params.get(UpdateRequest.VER); > if (params.containsKey(ShardParams._ROUTE_)) > updateRequest.deleteById(entry.getKey(), (String) > params.get(ShardParams._ROUTE_)); > else > updateRequest.deleteById(entry.getKey(), version); > {code} > Note that, since this code refers {{\_route\_}} parameter from properties of > {{UpdateRequest}}, this error doesn't occur if you use {{\_route\_}} request > parameter (like {{/update?\_route\_=foo}}) instead. > h1. How to reproduce > 1. start solr cloud with default configuration. > {code:bash} > $ ./bin/solr start -e cloud > {code} > 2. create new collection (named {{test}} here) with implicit router. > {code:bash} > $ curl > 'http://localhost:8983/solr/admin/collections?action=CREATE&name=test&router.name=implicit&shards=shard1,shard2&maxShardsPerNode=2&replicationFactor=2' > {code} > 3. send add and delete document requests. > {code:bash} > // add a document "id=foo" to shard1 > $ curl 'http://localhost:8983/solr/test/update?commit=true&_route_=shard1' -H > 'Content-Type: text/xml' --data-binary '<add><doc><field > name="id">foo</field></doc></add>' > // delete the document by using "_route_" request parameter (this is OK) > $ curl 'http://localhost:8983/solr/test/update?commit=true&_route_=shard1' -H > 'Content-Type: text/xml' --data-binary '<delete><id>foo</id></delete>' > // add a document "id=foo" to shard1 again > $ curl 'http://localhost:8983/solr/test/update?commit=true&_route_=shard1' -H > 'Content-Type: text/xml' --data-binary '<add><doc><field > name="id">foo</field></doc></add>' > // delete the document by using "_route_" attribute (this raises the error > mentioned above) > $ curl 'http://localhost:8983/solr/test/update?commit=true' -H 'Content-Type: > text/xml' --data-binary '<delete><id _route_="shard1">foo</id></delete>' > {code} > 4. stop solr cloud > {code:bash} > $ ./bin/solr stop -all > {code} > h1. How to fix > We can fix this issue by restoring {{UpdateRequest}} with {{version}} > correctly like the following code: > {code:java} > Long version = (Long) params.get(UpdateRequest.VER); > if (params.containsKey(ShardParams._ROUTE_)) > updateRequest.deleteById(entry.getKey(), (String) > params.get(ShardParams._ROUTE_), version); > else > updateRequest.deleteById(entry.getKey(), version); > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org