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

Use a specific error code for duplicate key error when sharded

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Sharding
    • None
    • ALL

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: