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:
-
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 bothC_oldANDC_new. This prevents either configuration from making independent decisions. -
Phase 2: Transition to C_new
OnceC_old,newis committed, the leader commits a second entry with onlyC_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.