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

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.0-rc1
    • Write Ops
    • None
    • 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 }" } ] }

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: