-
Type: Task
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: 3.2.5, 3.3.4
-
Component/s: Index Maintenance, WiredTiger
During an index build, the collection is locked in mode IX. Consider a background index build occurring with concurrent updates. Then, the following race scenario could occur:
1. Both the updater and the index builder read the same document.
2. To perform the update, the updater unindexes the document's old value.
3. Because the document has yet to be indexed, the WiredTiger returns WT_NOTFOUND. No WCE is generated.
4. The update proceeds to index the new value.
5. The indexer in the background, unaware of any WCEs, indexes the value it has read. The result is that the index has one too many keys.
We can fix this by having the update path trigger a write conflict exception even in the "no-op" case when unindexing returns WT_NOTFOUND.
(An alternative is to simply lock the collection in X mode during an index build, but this will probably have a large impact on performance.)
- is depended on by
-
SERVER-22970 Background index build produces an index with mismatched index keys and documents
- Closed
- is related to
-
SERVER-18844 Reacquire the snapshot after commit/abort
- Closed