Use a specific error code for duplicate key error when sharded

XMLWordPrintableJSON

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

      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 Tan
            Reporter:
            Bernie Hackett
            Votes:
            7 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: