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

Avoid serving stale majority reads on new primary after election

    • Replication
    • Fully Compatible
    • v8.0
    • Repl 2024-04-01, Repl 2024-04-15, Repl 2024-04-29, Repl 2024-05-13, Repl 2024-05-27, Repl 2024-06-10, Repl 2024-06-24, Repl 2024-07-08, Repl 2024-07-22, Repl 2024-08-05, Repl 2024-08-19

      After an election, the majority commit point on the new primary may be stale. This can cause a client that performs majority writes and majority reads with readPreference:"primary" to fail to read its own write after an election.

      Customers can work around this issue by using causally consistent sessions, but if the end user may interact with the database through multiple app servers, this requires passing the clusterTime token all the way back to the user's browser/app, which is impractical. It would be preferable if users can get read-your-writes by performing majority writes and majority reads with readPreference:"primary".

      One way to solve this is by blocking majority reads on the new primary until it commits its first write in the new term. This might require shortening the time taken to commit the first write in the new term.

      Note that even after this issue is addressed, clients that perform majority writes and majority reads with readPreference:"primary" may still fail to read their own writes after an unplanned election, if they are interacting with the database through multiple app servers or mongoses. However, this ticket describes the only known issue caused by planned maintenance, which accounts for the vast majority of elections.

            Assignee:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Reporter:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            49 Start watching this issue

              Created:
              Updated:
              Resolved: