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

Minimize and move tryToGoLiveAsASecondary

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.3.1
    • None
    • Replication
    • None
    • Fully Compatible
    • Repl 2019-08-26, Repl 2019-09-09, Repl 2019-09-23

    Description

      This free function in sync_tail.cpp is called several layers deep in the oplog application code. It is called before applying each batch, and it attempts to transition the member state to SECONDARY by calling several ReplicationCoordinator methods. I think the member state is typically RECOVERING or SECONDARY when this function is called.

      Judah theorizes that this function is practically obsolete and is typically a no-op, except in enableMajorityReadConcern false mode, where we do rollback via refetch. (Note from Jesse: yes this seems to be true. There's also forceRollbackViaRefetch but it can be removed, SERVER-41931.)

      Changing member state should be the responsibility of the ReplicationCoordinator, not SyncTail. Remove obsolete code from tryToGoLiveAsASecondary(), then convert it to a method in the ReplicationCoordinator. If possible, reverse control: the ReplicationCoordinator should trigger changes in oplog application after it decides to become a secondary, not vice-versa. However, it may not be possible: ReplicationCoordinator needs the applier to signal it when it is the right time to transition its state, just like signalDrainComplete, where we transition to Primary. If it's not possible to reverse control this way, then at least the code will be moved to the right class.

      Attachments

        Activity

          People

            jesse@mongodb.com A. Jesse Jiryu Davis
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: