[SERVER-7170] Upserts using unidexed query can result in duplicate documents Created: 26/Sep/12 Updated: 09/Jul/16 Resolved: 27/Dec/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 2.2.0, 2.3.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Randolph Tan | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
storm 0.8 |
||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
using strom, the threads(also in different process) run code:
and my storm log as following (node1 and node2 is different machine, the last two columns is using :System.currentTimeMillis(),Thread.currentThread() ):
there is no record in mytable meets the query
before they run, and after they run, there will exist exactly two same records, which I think is quite the opposite of what I know of the meaning of upsert = true. from the logs:
we can see that the commands which cause duplicated records is shown above. other conditions is: ), it works ok, no duplicated record generated. original thread: |
| Comments |
| Comment by Daniel Pasette (Inactive) [ 27/Dec/12 ] | |||||||
|
This is known behavior. upserts are not isolated without using the $atomic operator. | |||||||
| Comment by Randolph Tan [ 14/Oct/12 ] | |||||||
|
Fully reproducible in 2.3 (git version 352bd601c0fdaa24edf0357975f20abb0dddfb8c). Attaching test code - dup.js (might need to adjust numbers accordingly depending on what kind of machine it was run, see comments in test for more details). Here's the log from the failed case:
|