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

Use all_committed to set lastApplied on primary nodes

    • Fully Compatible
    • v3.6, v3.4, v3.2
    • Repl 2018-03-26
    • 50

      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.

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

              Created:
              Updated:
              Resolved: