[SERVER-16905] Concurrent upserts to the same non-existing document can result in duplicate key error Created: 16/Jan/15  Updated: 14/Sep/15  Resolved: 16/Jan/15

Status: Closed
Project: Core Server
Component/s: Concurrency, Write Ops
Affects Version/s: 2.8.0-rc5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

2.8.0-rc5, wiredTiger storage engine only


Issue Links:
Duplicate
duplicates SERVER-14322 Retry on predicate unique index viola... Closed
is duplicated by SERVER-20380 Upsert is not atomic when inserting Closed
Operating System: ALL
Steps To Reproduce:

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.

Participants:

 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.



 Comments   
Comment by Scott Hernandez (Inactive) [ 16/Jan/15 ]

dup of SERVER-14322, or a variation of that.

Generated at Thu Feb 08 03:42:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.