Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-4551

serverStatus counts duplicate key errors as inserts

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • v1.3.15
    • None
    • manual
    • None
    • OSX 10.9

    Description

      serverStatus is counting duplicate key errors as inserts.

      This is bad because a client might think that they are inserting documents when they're not.

      Steps to reproduce:

      • Look at the opcounter of serverStatus() increment when an insert fails to occur:

      mongos> db.foo.findOne()
      { "_id" : 3, "a" : 1 }
      mongos> db.serverStatus()["opcounters"]
      {
      	"insert" : 19,
      	"query" : 9,
      	"update" : 0,
      	"delete" : 0,
      	"getmore" : 0,
      	"command" : 114
      }
      mongos> db.foo.insert( { _id : 3 } )
      WriteResult({
      	"nInserted" : 0,
      	"writeError" : {
      		"code" : 11000,
      		"errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.foo.$_id_  dup key: { : 3.0 }"
      	}
      })
      mongos> db.serverStatus()["opcounters"]
      {
      	"insert" : 20,
      	"query" : 9,
      	"update" : 0,
      	"delete" : 0,
      	"getmore" : 0,
      	"command" : 118
      }
      mongos>

      Attachments

        Activity

          People

            sam.kleinman Sam Kleinman (Inactive)
            william.cross William Cross
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9 years, 8 weeks, 6 days ago