A candidate becomes leader only with a majority of votes.

highlighted = computed this step

A majority elects a leader

A candidate becomes leader only after it has a majority of votes in its term. The vote tally is recomputed from the timeout event. Note: the leader role appears after the win event.

majority election\text{majority election}

Vote tally

The majority threshold is 2 out of 3 nodes, and the tally has 3 votes. Note: the tally is shown in the render.

majority=2,nodes=3,votes=3\text{majority}=2,\quad \text{nodes}=3,\quad \text{votes}=3

a simplified Raft over a tiny cluster: terms, votes, leader election, and the term-restricted commit rule are exact on these traces; the full safety proof, membership changes, snapshotting, log compaction, and real RPC/timing are beyond these traces - no product claims.

Majority elects commitIndex 0 0 1 2 A t0/F t1/C t1/L B t0/F t1/F t1/F C t0/F t1/F t1/F vote tally t1 A:3 leader log A

Leader installed

The compiled trace has 1 leader. Note: the leader is a result of replaying the win event.

leaders=1\text{leaders}=1

a simplified Raft over a tiny cluster: terms, votes, leader election, and the term-restricted commit rule are exact on these traces; the full safety proof, membership changes, snapshotting, log compaction, and real RPC/timing are beyond these traces - no product claims.

Majority elects commitIndex 0 0 1 2 A t0/F t1/C t1/L B t0/F t1/F t1/F C t0/F t1/F t1/F vote tally t1 A:3 leader log A

Summary

A majority is what turns a candidate into a leader for a term. Note: this is simplified Raft; the full safety proof, membership changes, snapshots, and real timing are beyond these traces.

majority installs leader\text{majority installs leader}