[SERVER-13176] Wrong code for duplicate key error when downconverting update command Created: 12/Mar/14  Updated: 11/Jul/16  Resolved: 14/Mar/14

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.0-rc1
Fix Version/s: 2.6.0-rc2

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Greg Studer
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

A shard running 2.4, mongos 2.6.

mongos> db.unique_collection.createIndex({s: 1}, {unique: true})
WriteResult({ "nInserted" : 1 })
mongos> db.unique_collection.insert([{s:1}, {s: 2}])
BulkWriteResult({
	"writeErrors" : [ ],
	"writeConcernErrors" : [ ],
	"nInserted" : 2,
	"nUpserted" : 0,
	"nMatched" : 0,
	"nModified" : 0,
	"nRemoved" : 0,
	"upserted" : [ ]
})
mongos> db.unique_collection.update({s: 2}, {$set: {s: 1}})
WriteResult({
	"nMatched" : 0,
	"nUpserted" : 0,
	"nModified" : 0,
	"writeError" : {
		"code" : 11001,
		"errmsg" : "E11000 duplicate key error index: test1.unique_collection.$s_1  dup key: { : 1.0 }"
	}
})

If the shard is running 2.6, the error code is the expected 11000.

Participants:

 Description   

When a client executes the "update" command on mongos, and mongos sends OP_UPDATE to a shard, and the shard's GLE responds with a duplicate key error, mongos must convert the error code to 11000. However, mongos allows the code 11001 through to the client.

Clients written to raise a specific exception class for duplicate key errors in response to write commands only anticipate code 11000.



 Comments   
Comment by Githook User [ 14/Mar/14 ]

Author:

{u'username': u'gregstuder', u'name': u'Greg Studer', u'email': u'greg@10gen.com'}

Message: SERVER-13176 suppress legacy dup-key error codes when down/upconverting in mongos write cmds
Branch: master
https://github.com/mongodb/mongo/commit/03b1216f8e0df3f71bc94e2f3abd4b0d6465a7c4

Comment by Githook User [ 14/Mar/14 ]

Author:

{u'username': u'gregstuder', u'name': u'Greg Studer', u'email': u'greg@10gen.com'}

Message: SERVER-13176 suppress legacy dup-key error codes when down/upconverting in mongos write cmds
Branch: v2.6
https://github.com/mongodb/mongo/commit/34559b85ba96d241392e25ea76f3f00c130e3f2b

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