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

add namespace and key to duplicate key error in heap1

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.7.8
    • Component/s: Storage
    • Labels:
      None
    • ALL
    • Hide
      > use test2
      switched to db test2
      > db.test.createIndex( { filename: 1 }, { unique: 1 } );
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.test.insert( { filename: "test" } );
      WriteResult({ "nInserted" : 1 })
      > db.test.insert( { filename: "test" } );
      WriteResult({
      	"nInserted" : 0,
      	"writeError" : {
      		"code" : 11000,
      		"errmsg" : "E11000 duplicate key error dup key: { : \"test\" }"
      	}
      })
      

      (Tested with nightly mongodb-linux-x86_64-f5e67009ead674efb7cf16da2c1c462cc99424db-2014-10-30)

      Show
      > use test2 switched to db test2 > db.test.createIndex( { filename: 1 }, { unique: 1 } ); { "createdCollectionAutomatically" : true , "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } > db.test.insert( { filename: "test" } ); WriteResult({ "nInserted" : 1 }) > db.test.insert( { filename: "test" } ); WriteResult({ "nInserted" : 0, "writeError" : { "code" : 11000, "errmsg" : "E11000 duplicate key error dup key: { : \" test\ " }" } }) (Tested with nightly mongodb-linux-x86_64-f5e67009ead674efb7cf16da2c1c462cc99424db-2014-10-30)

      In mmapv1, a duplicate key error looks like:

      error message: Could not store file: %s:%d:%sE11000 duplicate key error index: phpunit.test_prefix.files.$filename_1%Sdup key: { : "test.txt" }
      

      With heap1, it looks like:

      error message: Could not store file: 127.0.0.1:30000: E11000 duplicate key error dup key: { : "test.txt" }
      

      It does not include the database name, collection name, or key name.

            Assignee:
            milkie@mongodb.com Eric Milkie
            Reporter:
            derick Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: