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

Use a specific error code for duplicate key error when sharded

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • ALL

      Most drivers raise a specific DuplicateKeyError exception for "duplicate key" errors. They do this by checking error returns for specific error codes.

      mongos raises error code 16460 for a range of insert errors, including duplicate key error. That error should be handled separately, using a specific code (ErrorCodes::DuplicateKey is appropriate).

      The sharding code in question:

      https://github.com/mongodb/mongo/blob/master/src/mongo/s/strategy_shard.cpp#L704-L726

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            7 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: