[SERVER-60735] Make duplicate key error message more meaningful with arbitrary cluster keys Created: 15/Oct/21  Updated: 03/Jan/23  Resolved: 03/Jan/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Josef Ahmad Assignee: Backlog - Storage Execution Team
Resolution: Won't Do Votes: 0
Labels: PM-2311-M3, clustered_collections
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Storage Execution
Participants:

 Description   

Currently the RecordStore's duplicate key error message assumes the primary key is always _id. For example, on a collection clustered by ts:

> db.c.count()
0
> db.c.insertOne({_id:0, ts:1})
{ "acknowledged" : true, "insertedId" : 0 }
> db.c.insertOne({_id:1, ts:1})
WriteError({
	"index" : 0,
	"code" : 11000,
	"errmsg" : "E11000 duplicate key error collection: local.c dup key: { _id: 1 }",
	"op" : {
		"_id" : 1,
		"ts" : 1
	}
}) :

The output is misleading: the duplicate key is actually ts, not the reported _id.

Extend it to make the error message meaningful with arbitrary cluster keys.



 Comments   
Comment by Connie Chen [ 03/Jan/23 ]

Closing as won't do as we are moving away from clustered collections

Generated at Thu Feb 08 05:50:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.