-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 7.0.0, 8.0.0, 9.0.0-rc0, 8.3.0
-
Component/s: None
-
None
-
Catalog and Routing
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When updating a document's shard key in a way that requires moving the document to a different shard, the operation deletes the document from the current shard and inserts it on the shard owning the target key range, inside a transaction. The issue arises when the target shard of that insert is the same shard that previously donated the chunk containing the document and still retains the orphaned documents. When the shard key update then tries to insert the document with its new shard key value on that shard, it hits a duplicate key error on id due to the orphan. The operation fails with error code 11000 and the message: "Failed to update document's shard key field. There is either an orphan for this document or _id for this collection is not globally unique. :: caused by :: During insert stage of updating a shard key :: caused by :: E11000 duplicate key error collection: test.foo index: _id dup key:
{ _id: 1.0 }".
- related to
-
SERVER-40483 Changing the shard key could lead to DuplicateKeyError on _id with orphan documents
-
- Closed
-