定理
P1. An acceptor must accept the first proposal that it receives.
P1a
. An acceptor can accept a proposal numbered n iff it has not responded
to a prepare request having a number greater than n.
P2. If a proposal with value v is chosen, then every higher-numbered proposal that is chosen has value v.
P2a
. If a proposal with value v is chosen, then every higher-numbered proposal accepted by any acceptor has value v.
P2b
. If a proposal with value v is chosen, then every higher-numbered proposal issued by any proposer has value v.
P2c
. For any v and n, if a proposal with value v and number n is issued,
then there is a set S consisting of a majority of acceptors such that
either (a) no acceptor in S has accepted any proposal numbered less
than n, or (b) v is the value of the highest-numbered proposal among
all proposals numbered less than n accepted by the acceptors in S.
算法流程
Phase 1. (a) A proposer selects a proposal number n and sends a prepare
request with number n to a majority of acceptors.
(b) If an acceptor receives a prepare request with number n greater
than that of any prepare request to which it has already responded,
then it responds to the request with a promise not to accept any more
proposals numbered less than n and with the highest-numbered proposal (if any) that it has accepted.
Phase 2. (a) If the proposer receives a response to its prepare requests
(numbered n) from a majority of acceptors, then it sends an accept
request to each of those acceptors for a proposal numbered n with a
value v, where v is the value of the highest-numbered proposal among
the responses, or is any value if the responses reported no proposals.
(b) If an acceptor receives an accept request for a proposal numbered
n, it accepts the proposal unless it has already responded to a prepare
request having a number greater than n.
参考资料
The Part-Time Parliament, by Leslie Lamport
Paxos Made Simple, by Leslie Lamport
Paxos Made Live, by Tushar Chandra, Robert Griesemer and Joshua Redstone
Paxos Made Moderately Complex, by ROBBERT VAN RENESSE and DENIZ ALTINBUKEN