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

Use all_committed to set lastApplied on primary nodes

    XMLWordPrintable

    Details

      Description

      Currently, for a node in PRIMARY state, lastApplied is set to each write's optime when each write commits, as long as the time being set moves forward. (It might not otherwise always move forward because writes can commit out of optime order.)
      This method of setting lastApplied is problematic for consumers of this value, as it can be set ahead of writes that are still in-flight and have yet to commit. For one-voting-node replica sets, this can result in the majority point moving ahead of uncommitted, in-flight writes.

      Instead, we can use WiredTiger's all_committed value to set lastApplied. After each write commits, we can query the current all_committed value and set lastApplied to that.
      The all_committed value is the greatest (latest) timestamp value with no existing in-flight writes with lower (earlier) timestamps. This value has been used in the past to implement oplog visibility, preventing oplog readers from reading past "holes" in the oplog left by uncommitted, in-flight writes.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              judah.schvimer Judah Schvimer
              Reporter:
              milkie Eric Milkie
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: