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

Vectored inserts incorrectly timestamp index updates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.6.0, 3.7.1
    • Fix Version/s: 4.0.0-rc1, 4.1.1
    • Component/s: Storage
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.0, v3.6
    • Sprint:
      Storage NYC 2018-05-21, Storage NYC 2018-06-04
    • Linked BF Score:
      0

      Description

      A vectored insert is when one WriteUnitOfWork (transaction) performs multiple document inserts before committing. This mechanism is used on primaries for bulk writes and secondaries during oplog application.

      A typical insert executes in the order of:

      1. Insert new document into the record store.
      2. For each index, calculate the document's index key and update the index.

      A vectored insert instead works as:

      1. Insert document A into the record store.
      2. Insert document B into the record store.
      3. Calculate and update indexes for A.
      4. Calculate and update indexes for B.

      Performing the same actions but adding in timestamps:

      1. Set the timestamp to T(A).
      2. Insert document A into the record store (gets T(A)).
      3. Set the timestamp to T(B).
      4. Insert document B into the record store (gets T(B)).
      5. Update indexes for A (gets T(B)).
      6. Update indexes for B (gets T(B)).

      Scanning the collection at T(A) will show document A, but searching for A via an index will not succeed.

      Secondaries are currently immune to observing this anomaly; read timestamps on a secondary (e.g: majority reads) must take place on a batch boundary. This was intended to ensure that unique indexes could not be observed in a temporarily inconsistent state.

        Attachments

          Activity

            People

            Assignee:
            milkie Eric Milkie
            Reporter:
            daniel.gottlieb Daniel Gottlieb
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: