Handout for CSEP 552 lecture 4 Dan Ports Based on notes from MIT course 6.824 --- Paxos Proposer --- 1 proposer(v): 2 while not decided: 2 choose n, unique and higher than any n seen so far 3 send propose(n) to all servers including self 4 if propose_ok(n, na, va) from majority: 5 v' = va with highest na; choose own v otherwise 6 send accept(n, v') to all 7 if accept_ok(n) from majority: 8 send decided(v') to all --- Paxos Acceptor --- 9 acceptor state on each node (persistent): 10 np --- highest propose seen 11 na, va --- highest accept seen 12 acceptor's propose(n) handler: 13 if n > np 14 np = n // promise not to accept any // lower-numbered proposal 15 reply propose_ok(n, na, va) 16 else 17 reply propose_reject 18 acceptor's accept(n, v) handler: 19 if n >= np 20 np = n // promise not to accept any // lower-numbered proposal 21 na = n // and make sure that any 22 va = v // higher-numbered proposal // finds out about the value // we accepted 23 reply accept_ok(n) 24 else 25 reply accept_reject