[SERVER-17532] Duplicate key error message does not contain index name anymore Created: 11/Mar/15  Updated: 18/Sep/15  Resolved: 11/Mar/15

Status: Closed
Project: Core Server
Component/s: WiredTiger
Affects Version/s: 3.0.0
Fix Version/s: 3.0.2, 3.1.0

Type: Bug Priority: Major - P3
Reporter: Rainer Frey Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: Fit&Finish
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Steps To Reproduce:

In mongo shell:

db.test.insert({_id: "test"})
db.test.insert({_id: "test"})

Result with WiredTiger:

WriteResult({
	"nInserted" : 0,
	"writeError" : {
		"code" : 11000,
		"errmsg" : "E11000 duplicate key error dup key: { : \"test\" }"
	}
})

Result with MMAPv1:

WriteResult({
	"nInserted" : 0,
	"writeError" : {
		"code" : 11000,
		"errmsg" : "E11000 duplicate key error index: rfy.test.$_id_ dup key: { : \"test\" }"
	}
})

Participants:

 Description   

With WiredTiger, the error returned by a duplicate key does not contain the name of the violated unique index. It is therefore not possible to identify which field in the inserted document causes the violation.



 Comments   
Comment by Githook User [ 25/Mar/15 ]

Author:

{u'username': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-17532: fix dup key error message in wiredtiger index

(cherry picked from commit 5fd3dfce18655932165ebadef0bbe5ed58f678de)
Branch: v3.0
https://github.com/mongodb/mongo/commit/ff7ae37d3f16a73e9ee956c31d6938f4768000dd

Comment by Ilya Kantor [ 24/Mar/15 ]

Guess mongo guys are too busy to reply.

Asked my colleagues, the feedback says – 3.0 is not even a "for development" release, and very far from production.
Rolling back my development to a stable mongo.

Comment by Ilya Kantor [ 17/Mar/15 ]

Thanks! 3.0.2 is going to be... really soon, right?

Comment by Ilya Kantor [ 17/Mar/15 ]

This bug breaks my project, cause it shows the error message depending on the index. And the index is just not provided now.

As of now, could you please tell the approximate estimate of the release with this bug fixed?

Or maybe I should reinstall Mongo and use 3.0.0 with the old storage engine?

Comment by Eliot Horowitz (Inactive) [ 17/Mar/15 ]

It is still being decided if we'll backport to 3.0.x.
If we decide to (or not to) all updates will be on this ticket.

Comment by Rainer Frey [ 17/Mar/15 ]

Thanks for fixing. I see that a back port to 3.0 is requested. What is the procedure for this? Is it still to be decided whether that will be done? And if done, will the fixed version be added to this issue, or is there a separate back port issue (or any other way for me to notice that there's a version put with this fix)?

Comment by Githook User [ 11/Mar/15 ]

Author:

{u'username': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-17532: fix dup key error message in wiredtiger index
Branch: master
https://github.com/mongodb/mongo/commit/5fd3dfce18655932165ebadef0bbe5ed58f678de

Comment by Rainer Frey [ 11/Mar/15 ]

This issue is relevant for collections with more than one unique index, of course. I used the _id index as an example, but the behavior is the same for a custom unique index.

We use the Java driver, and there's the same difference in the message of the DuplicateKeyException. A solution that makes the violated index name available in the DuplicateKeyException's associated CommandResult object would be sufficient (even preferred) for us. A fix for other interfaces like mongo shell is nice to have but not relevant to us.

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