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

Background sync may erroneously set applied-through during step-up

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 4.2.8
    • Fix Version/s: 4.9.0, 4.4.2, 4.2.12
    • Component/s: Replication
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.4, v4.2
    • Sprint:
      Repl 2020-10-05, Repl 2020-10-19

      Description

      The bgsync _producer() method runs in a loop until stop() is called asynchronously.

      If, after this critical section is run

      https://github.com/mongodb/mongo/blob/ea1ad14260cad77823a549a22a32a97621d58a35/src/mongo/db/repl/bgsync.cpp#L425

      stop() is called (as it would be during step-up), then before

      https://github.com/mongodb/mongo/blob/ea1ad14260cad77823a549a22a32a97621d58a35/src/mongo/db/repl/bgsync.cpp#L441

      is reached, the primary clears the applied-through time (as it normally does), the applied-through time will be re-set to the last applied optime. This state will persist until the next time the node becomes secondary and applies a batch. If the node restarts during that time, it will invariant and need to be re-synced.

      We need to hold the mutex and ensure the producer is running while checking if applied-through is clear and setting it.

        Attachments

          Activity

            People

            Assignee:
            samy.lanka Samyukta Lanka
            Reporter:
            matthew.russotto Matthew Russotto
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: