Detailed introduction Paxos

in paxos •  4 years ago 

Character introduction:

Client: external role of the system, request initiator. Like the people.

Proposer: Accept Client requests and propose to the cluster. And when conflict occurs, it plays a role in conflict adjustment. Such as a member of Parliament, who proposes a bill for the public.

Accpetor: Proposal votes and recipients. Only when a quorum (Quorum, Majority) is formed, will the proposal be finally accepted. Such as Congress.

Learner: The proposal acceptor, backup, backup, have no effect on the consistency of the cluster. Such as the recorder.

Steps and stages:

1.Phase1a: Prepare

The proposer proposes a proposal with the number N. N must be greater than the proposal number proposed by the proposer before, and request the acceptor's quorum (mostly) to accept it.

2.Phase1b: Promise

If N is greater than any proposal number previously accepted by this acceptor, accept it, otherwise reject it.

3.Phase2a: Accept

If the majority is reached, the proposer will issue an accept request, which contains the proposal number and proposal content from the previous step.

4.Phase2b: Accepted

If this acceptor does not receive any proposal greater than N during this period, the content of this proposal is accepted, otherwise it is ignored.

Remember that we mentioned above that synchronizing numbering is a very important issue. The green box is actually the process of synchronizing numbering. Through this number, you can know the sequence of each operation log. Simply put, in the first stage, the number is obtained, and in the second stage, the log is written. It can be seen that Paxos compensates for the consistency problem through two rounds of interaction, sacrificing time and performance.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!