Course contentsShow
← System Design
Lesson 631 of 1,91917. Consensus AlgorithmsFree lesson

Membership Changes: Joint Consensus

How Raft safely changes cluster membership using a two-phase joint consensus approach to avoid split-brain scenarios.

Membership Changes: Joint Consensus

You'll learn how Raft safely reconfigures a cluster without risking split-brain scenarios during membership transitions.

The Membership Change Problem

When you need to add or remove servers from a Raft cluster (changing from old configuration C_old to new configuration C_new), you can't switch atomically across all servers. If servers switch at different times, you risk having two separate majorities elect different leaders simultaneously—a split-brain disaster.

For example, switching from 3 servers to 5 servers: if some servers think majority = 2/3 while others think majority = 3/5, two leaders could be elected in the same term.

Joint Consensus: The Two-Phase Solution

Raft uses joint consensus to bridge configurations safely:

  1. Phase 1: Enter Joint Consensus (C_old,new)
    The leader commits a special log entry representing both configurations simultaneously. During this phase, decisions (elections, commits) require majorities in both C_old AND C_new. This prevents either configuration from making independent decisions.

  2. Phase 2: Transition to C_new
    Once C_old,new is committed, the leader commits a second entry with only C_new. Now only the new configuration's majority matters.

Analogy: Like a relay race where both runners hold the baton simultaneously during the handoff—no moment exists where neither has control.

Safety Guarantee

Because joint consensus requires overlapping majorities, any leader elected in C_old must overlap with any leader elected in C_new during the transition. This prevents split-brain: you cannot have conflicting majorities.

Key Takeaway: Joint consensus prevents split-brain during membership changes by requiring dual majorities during the transition period, ensuring cluster safety throughout reconfiguration.