[SERVER-8516] unique index allowed insertion of duplicate Created: 11/Feb/13 Updated: 15/Feb/13 Resolved: 12/Feb/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Daniel Kim | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Amazon ec2 server using Ubuntu 12.04.1 LTS and EBS |
||
| Operating System: | Linux |
| Participants: |
| Description |
|
A duplicate document somehow made it into a collection with a unique index. I did not discover that this occurred for some time – after an ensureIndex call on the collection failed. Both inserts occurred at about the same time – the timestamps for their respective ObjectId's are equivalent. What is strange is that two inserts were not actually executed against the collection, yet somehow two duplicate records ended up in the collection. |
| Comments |
| Comment by Daniel Kim [ 12/Feb/13 ] |
|
Hi Scott, Thanks for the timely response. After I restored a backup to get a dump and looked through the mongo logs I discovered that the collection in question did not actually have the appropriate unique index. My system always ensures indices on startup but I forgot that I had dropped the database at some point after starting up and before a test run and had never rebuilt the indices. I apologize for the false alarm! It was a long day ... -dk |
| Comment by Scott Hernandez (Inactive) [ 12/Feb/13 ] |
|
Can you please provide the documents (mongodump would be best), index definitions (system.indexes entries) and conditions you believe caused this state? Please also describe your mongodb deployment; is it a replic set, sharded cluster or just a single server including versions and updated/orig versions. |