[SERVER-37124] Retry full upsert path when duplicate key exception matches exact query predicate Created: 13/Sep/18  Updated: 29/Oct/23  Resolved: 29/Nov/18

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: 4.1.6

Type: Improvement Priority: Major - P3
Reporter: Asya Kamsky Assignee: James Wahlin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-38038 mongo shell should be linked with Err... Closed
depends on SERVER-38175 Invariant on error codes with ErrorEx... Closed
depends on SERVER-14801 duplicate key error should report fie... Closed
Documented
is documented by DOCS-12234 Docs for SERVER-37124: Retry full ups... Closed
Duplicate
is duplicated by SERVER-14322 Retry on predicate unique index viola... Closed
is duplicated by SERVER-37532 Retry update on specific duplicate in... Closed
Related
related to SERVER-38461 performSingleUpdateOpWithDupKeyRetry ... Closed
related to SERVER-44980 wrong update result with upsert:true Closed
related to SERVER-50454 Avoiding sending the "keyValue" field... Closed
is related to SERVER-47212 Retry full upsert path when duplicate... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2018-11-05, Query 2018-11-19, Query 2018-12-03
Participants:
Case:
Linked BF Score: 95

 Description   

Subset of cases described in SERVER-14322 that can be safely retried as an upsert is when insert portion of update receives a duplicate key exception with duplicate key-values combination matching the query exactly.

Example:

db.foo.update({_id:5},{$set:{...}\},{upsert:true})

can safely retry full upsert if it receives error

"E11000 duplicate key error collection: bar.foo index: id dup key: { : 5.0 }"



 Comments   
Comment by Githook User [ 29/Nov/18 ]

Author:

{'name': 'James Wahlin', 'email': 'james@mongodb.com', 'username': 'jameswahlin'}

Message: SERVER-37124 Retry full upsert path when duplicate key exception matches exact query predicate
Branch: master
https://github.com/mongodb/mongo/commit/01d25f74348e8594e96a9e01dfca60538677d078

Comment by Githook User [ 16/Nov/18 ]

Author:

{'name': 'James Wahlin', 'email': 'james@mongodb.com', 'username': 'jameswahlin'}

Message: SERVER-37124 Disambiguate DuplicateKey error and return keyPattern details in errorInfo object
Branch: master
https://github.com/mongodb/mongo/commit/410656e971aff8f491a87337a17d04bd866389ba

Comment by Andy Schwerin [ 11/Oct/18 ]

If we implement this, we should do so by extending the DuplicateKey error's "extra error info" type to include the key pattern, rather than re-parsing the error message.

Comment by Asya Kamsky [ 10/Oct/18 ]

Storage performed the work providing the information about which index caused the duplicate error.

Generated at Thu Feb 08 04:45:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.