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

Concurrent upserts to the same non-existing document can result in duplicate key error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.8.0-rc5
    • None
    • Concurrency, Write Ops
    • None
    • 2.8.0-rc5, wiredTiger storage engine only
    • ALL
    • Hide

      Run the Java code from this gist: https://gist.github.com/anonymous/5221f3025b549a708299

      Expected result:

      One thread will "win" and be the one to insert the document. The rest will see the insert and just update the existing document.

      Actual result:

      Depending on timing, there are 0-4 exceptions thrown indicating a duplicate key error.

      Show
      Run the Java code from this gist: https://gist.github.com/anonymous/5221f3025b549a708299 Expected result: One thread will "win" and be the one to insert the document. The rest will see the insert and just update the existing document. Actual result: Depending on timing, there are 0-4 exceptions thrown indicating a duplicate key error.

    Description

      A test program that starts five threads, each repeatedly upserting a document with the same _id to a collection that doesn't initially contain a document with that _id, will encounter duplicate key errors on the first attempt from 0-4 of the five threads, depending on timing.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jeff.yemin@mongodb.com Jeffrey Yemin
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: