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

replSetReconfig with concurrent election can trigger invariant

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.12, 4.0.8, 4.1.7
    • Affects Version/s: 3.6.11, 4.0.7, 4.1.6
    • Component/s: Replication
    • ALL
    • v4.0, v3.6, v3.4
    • Repl 2018-10-22, Repl 2018-11-05, Repl 2019-01-14
    • 52

      If a replSetReconfig runs on a node that is concurrently processing a successful election win, it is possible to trigger this invariant. The ReplicationCoordinatorImpl::_onVoteRequestComplete method is called when the VoteRequester completes. In the case of a successful election, we will print this message, and then proceed to processing the election win. We will reset the VoteRequester and then update our member state to reflect our transition to leader. Before we call _performPostMemberStateUpdateAction, though, we unlock the ReplicationCoordinator mutex. This allows a concurrent reconfig command, currently running ReplicationCoordinatorImpl::_finishReplSetReconfig, to end up cancelling an election before we have transitioned to Leader mode. We call ReplicationCoordinatorImpl::_cancelElectionIfNeeded_inlock when the _voteRequester has been reset, but while we are still in the Candidate role. So, we will not return early here, and will end up hitting the subsequent invariant, since the VoteRequester was already destroyed.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            william.schultz@mongodb.com Will Schultz
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: