Info
The WiredTigerIndex class stores a copy of the collection name in a _collectionNamespace constant, but this becomes invalid on rename. Indeed the index should not refer back to its parent collection as that can change.
Top User Comments
xgen-internal-githook commented on Tue, 20 Oct 2020 00:20:27 +0000:
Author:
{'name': 'Geert Bosch', 'email': 'geert@mongodb.com', 'username': 'GeertBosch'}
Message: SERVER-47647 Test that duplicate key error message has correct namespace after rename
Branch: master
https://github.com/mongodb/mongo/commit/1e9b12b0f58fef211740546d5d162694d5cbbcf7
geert.bosch commented on Mon, 29 Jun 2020 20:20:20 +0000:
Only work remaining is adding a test case.
geert.bosch commented on Mon, 29 Jun 2020 20:19:29 +0000:
Removing the Collection* from the IndexDescriptor fixed this issue.
Steps to Reproduce
> db.x.insert({_id:1})
WriteResult({ "nInserted" : 1 })
> db.x.renameCollection("y")
{ "ok" : 1 }
> db.y.insert({_id:1})
WriteResult({
"nInserted" : 0,
"writeError" : {
"code" : 11000,
"errmsg" : "E11000 duplicate key error collection: test.x index: _id_ dup key: { _id: 1.0 }"
}
})