You run a three-server Raft cluster and want to grow it to five. Why is it dangerous to push the new five-server configuration to every server at once, and what are the safe alternatives?
Sketch your own answer first, then compare it with the one below.
A strong answer
The servers will not all switch at the same instant. Suppose two servers still use the old configuration and three have the new one. In the old view, two of three is a majority, so the pair can elect a leader. In the new view, three of five is a majority, so the other group can elect a different leader, possibly in the same term. The two majorities share no server, so two leaders can commit different entries.
Raft's original answer is joint consensus. First the cluster moves to a combined configuration, where every election and commit needs a majority of the old set and a majority of the new set. Once that entry is committed, the leader writes the new configuration alone. At no point can either side decide on its own.
The simpler approach, described in Ongaro's dissertation, changes one server at a time. Going from 3 to 4, a majority of the old set is 2 and of the new set is 3, and 2 + 3 > 4, so any two majorities overlap. Five servers means two such steps. New servers should also join as non-voting members first and be counted only after they have caught up on the log, so that an empty newcomer cannot stall commits.
Sources
- Diego Ongaro, John Ousterhout (2014). In Search of an Understandable Consensus Algorithm.