Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-23807

Updates should always throw WriteConflictException on unindexing

    XMLWordPrintable

Details

    • Fully Compatible
    • Integration 13 (04/22/16)

    Description

      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.)

      Attachments

        Issue Links

          Activity

            People

              kyle.suarez@mongodb.com Kyle Suarez
              kyle.suarez@mongodb.com Kyle Suarez
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: