[SERVER-13151] Ordered write command (insert) doesn't report writeConcernError if there was also a writeError Created: 12/Mar/14  Updated: 12/Mar/14  Resolved: 12/Mar/14

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.6.0-rc1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Three member replica set


Operating System: ALL
Steps To Reproduce:

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 }"
		}
	]
}

Participants:

 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.



 Comments   
Comment by Scott Hernandez (Inactive) [ 12/Mar/14 ]

This is by design; in an ordered write command the writeConcern is only enforced if there are no errors.

Generated at Thu Feb 08 03:30:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.