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

Make duplicate key error message more meaningful with arbitrary cluster keys

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:

      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.

        Attachments

          Activity

            People

            Assignee:
            backlog-server-execution Backlog - Storage Execution Team
            Reporter:
            josef.ahmad Josef Ahmad
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: