Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-47647

Duplicate key error message has incorrect namespace after rename

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: Catalog, Storage
    • Fully Compatible
    • ALL
    • Hide
      > 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 }"
      	}
      })
      
      Show
      > 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 }" } })
    • Execution Team 2020-09-07, Execution Team 2020-09-21, Execution Team 2020-10-05, Execution Team 2020-10-19, Execution Team 2020-11-02

      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.

            Assignee:
            geert.bosch@mongodb.com Geert Bosch
            Reporter:
            geert.bosch@mongodb.com Geert Bosch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: