Ordered write command (insert) doesn't report writeConcernError if there was also a writeError

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.0-rc1
    • Component/s: Write Ops
    • None
    • Environment:
      Three member replica set
    • ALL
    • Hide

      With a 3-member replica set

      1. replset:PRIMARY> db.test.insert({_id : 1})
      2. replset:PRIMARY> db.runCommand( { "insert" : "test", ordered : true, writeConcern : {w : 4, wtimeout : 1} , documents : [ { _id : 2}, { _id : 1}] } )

      Expected results: Response should include both a writeError, for the duplicate key on the second document, and a writeConcernError, for the failure to apply the write concern.

      Actual results: Response includes only a writeError:

      {
      	"ok" : 1,
      	"n" : 1,
      	"lastOp" : Timestamp(1394631652, 1),
      	"electionId" : ObjectId("5320632cde980d54604b54f8"),
      	"writeErrors" : [
      		{
      			"index" : 1,
      			"code" : 11000,
      			"errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.test.$_id_  dup key: { : 1.0 }"
      		}
      	]
      }
      
      Show
      With a 3-member replica set 1. replset:PRIMARY> db.test.insert({_id : 1}) 2. replset:PRIMARY> db.runCommand( { "insert" : "test", ordered : true, writeConcern : {w : 4, wtimeout : 1} , documents : [ { _id : 2}, { _id : 1}] } ) Expected results: Response should include both a writeError, for the duplicate key on the second document, and a writeConcernError, for the failure to apply the write concern. Actual results: Response includes only a writeError: { "ok" : 1, "n" : 1, "lastOp" : Timestamp(1394631652, 1), "electionId" : ObjectId("5320632cde980d54604b54f8"), "writeErrors" : [ { "index" : 1, "code" : 11000, "errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.test.$_id_ dup key: { : 1.0 }" } ] }
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      An ordered bulk insert with both a write error and a write concern error only reports the write error.

      An unordered bulk insert reports both errors, as expected.

            Assignee:
            Unassigned
            Reporter:
            Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: