[SERVER-37919] Unique index with partialFilterExpression option causes WriteConflict Created: 05/Nov/18 Updated: 27/Oct/23 Resolved: 30/Nov/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Concurrency, Index Maintenance |
| Affects Version/s: | 4.0.3, 4.1.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Dan Bolar | Assignee: | Xiangyu Yao (Inactive) |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Storage NYC 2018-12-03 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: |
| Description |
|
An attempt to delete two documents from the same collection from two different transactions results in a WriteConflict exception if the collection has a unique index with the partialFilterExpression option and the field for that index is left unset in both documents. |
| Comments |
| Comment by Xiangyu Yao (Inactive) [ 29/Nov/18 ] |
|
Closing this ticket as the work to backport the fix to 4.0 is extensive, and an easy workaround exists: apps can retry transactions when encountering this situation. |
| Comment by Dan Bolar [ 27/Nov/18 ] |
|
I completely uninstalled 4.0 and did a fresh install of 4.1 and the lock issue no longer occurs with the new data directory. |
| Comment by Xiangyu Yao (Inactive) [ 27/Nov/18 ] |
|
Got it. Did you run the v4.1.4 binary with a new data directory or the same data directory that v4.0 binary used? In that case, v4.1.4 binary will read the WiredTiger's metadata set by v4.0 binary and use the old unique index key format. |
| Comment by Dan Bolar [ 27/Nov/18 ] |
|
I was able to reproduce the issue on 4.1.4. mongod --version |
| Comment by Xiangyu Yao (Inactive) [ 27/Nov/18 ] |
|
Hi dbolar, I saw 4.1.4 is in 'Affects Versions'. Did you run the test on that version and get the failure? I tried running your repo on my local copy of 4.1.4 and didn't experience the failure. |
| Comment by Xiangyu Yao (Inactive) [ 27/Nov/18 ] |
|
There are two behaviors which when combined will cause this problem: (This is a 4.0-only problem because in 4.2 we have a new unique index key format which has record id appended to the key; thus step 2 won't trigger a write conflict in the described case). |