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

LastOpFixer can set Client optime backwards in sessions

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Gone away
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Replication
    • None
    • Replication
    • ALL
    • 45

    Description

      In write_ops_exec.cpp, there is a class called LastOpsFixer, which sets the client's optime to the system time in the case of a failed or no-op write (e.g. a $set of a field to the value it is already set to).

      As long as LastOpsFixer runs outside any WriteUnitOfWork (the normal case), this is fine. However, with sessions we can have a long-lived outer WUOW. In this case, if we have multiple operations, one of them can succeed and one can be a no-op. The successful operation will set the client optime to its optime on WUOW commit. The no-op will set the client optime to the system optime immediately.

      If other operations happen in between the successful operation and the no-op, advancing the system optime, this results in the commit setting the client optime backwards (and hitting an invariant).

      This currently happens only when writing in a snapshot read.

      Attachments

        Activity

          People

            backlog-server-repl Backlog - Replication Team
            matthew.russotto@mongodb.com Matthew Russotto
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: