Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raft: forget the leader when stepping down if it's safe #134990

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Commits on Nov 22, 2024

  1. raft: start bcasting defortification messages when stepping down

    Right now, we start bcasting defortificaton messages at heartbeat
    timeouts. However, there is nothing that prevents us from starting this
    process even earlier. This commit starts this process when stepping down
    immediately after becoming a follower.
    
    Epic: None
    
    Release notes: None
    iskettaneh committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    467edd0 View commit details
    Browse the repository at this point in the history
  2. raft: allow forgetting the leader within the same term

    This commit allows us to forget the leader when stepping down. We can't
    just call `r.resetLead()` inside `r.reset()` because it would defortify
    in all places where we stepdown to the same term. Once we make it safe
    in all places to stepdown to the same term and forget the leader, we
    can call r.resetLead() inside r.reset().
    
    Epic: None
    
    Release note: None
    iskettaneh committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    89f0563 View commit details
    Browse the repository at this point in the history
  3. raft: forget the leader when stepping down from CheckQuorum

    In checkQuorum, if we decide to step down, it means that a majority
    of replicas don't support us. Therefore, it's safe to step down and
    forget that we were the leader at this term. We can safely campaign
    and participate in elections.
    
    Epic: None
    
    Release note: None
    iskettaneh committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    5aa9da7 View commit details
    Browse the repository at this point in the history
  4. raft: forget the leader when transferring leadership

    Since leadership transfer means that the current leader instructs
    another replica to campaign without performing safety checks. It
    should be safe to forget the leader when stepping down.
    
    Epic: None
    
    Release note: None
    iskettaneh committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    e7baa61 View commit details
    Browse the repository at this point in the history
  5. raft: forget the leader when a leader becomes a learner

    When a current leader becomes a learner, it should be safe to step down
    and forget that we were the leader at the current term because:
    (1) learners can't campaign or participate in elections, and (2) in
    order for a learner to become a voter again, a new leader needs to get
    elected and propose that change, which means that the replica would be
    able to safely participate in elections then.
    
    Epic: None
    
    Release note: None
    iskettaneh committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    1fdb01a View commit details
    Browse the repository at this point in the history
  6. raft: forget the leader after a restart if we were the leader

    This commit makes us forget that we were the leader at this term after
    a restart.
    
    Epic: None
    
    Release notes: None
    iskettaneh committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    f4b5705 View commit details
    Browse the repository at this point in the history
  7. raft: forget the leader when stepping down after a VoteLost

    We already forget the leader when attempting to campaign. This commit
    doesn't change any current behaviour.
    
    Epic: None
    
    Release notes: None
    iskettaneh committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    1468e03 View commit details
    Browse the repository at this point in the history