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

Change stream updateLookup queries with speculative majority may return uncommitted data

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.10
    • Affects Version/s: 4.1.7
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • Repl 2019-02-25, Repl 2019-03-11, Repl 2019-03-25
    • 57

      Speculative majority change streams that do an update lookup query will wait for the most recent lastApplied optime of a replica set node to majority commit before returning results to the client. This is intended to provide a guarantee to the client that the data it received is majority committed. This contract may be violated, however, in the case where a node's lastApplied optime lags behind the optime of the newest "storage committed" oplog entry. That is, there may be an oplog entry (and corresponding data operation) written to storage that is visible to readers, but the lastApplied optime of the node does not yet reflect it. This is possible because a primary node advances its lastApplied optime inside the onCommit handler of an operation's transaction. There is a nonzero length of time between the commit of the WriteUnitOfWork at the storage layer and when the optime is advanced for that operation. If a concurrent reader reads the effects of such a transaction and reads lastApplied before the onCommit handler has fired, it may wait for the incorrect optime to commit and return data that is not, in fact, majority committed. This is an issue for primaries. On secondaries lastApplied is only updated at the end of batch application, so the same problem does not manifest.

            Assignee:
            william.schultz@mongodb.com William Schultz (Inactive)
            Reporter:
            william.schultz@mongodb.com William Schultz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: