Know is know, noknow is noknow, is know

01, role,

Proposer: is responsible for proposing a proposal, known as a value(vauE is a paXOS protocol that abstracts an operation into a value).

Proposer: handles proposals submitted by acceptors that have been approved by a majority of acceptors.

Learner: Does not participate in the election and synchronizes the status related to major parameters.

02. Election process

The flow chart is as follows:

Concrete implementation:

1. Proposer generates a unique ID (proposalID) and then sends a prepare request with its proposalID to acceptors.

2. If an Acceptor receives a prepare request, it determines whether its proposalID is greater than that of any proposals it has previously responded to.

  • If so, a proposalID is persisted locally, then populated with a proposalID in max_proposalID, and then replies with a value of its proposalID (which is empty the first time), and no proposals less than proposalID are accepted.

  • If no, do not reply or reply to Error

3. A Proposer receives a number of prepare responses after a period of time

  • If more than half of the responses are numbered with empty values, the Proposer sends a accept request with its own values.

  • If more than half of the responses are numbered and the value is not empty, the Proposer sends a accept request with the largest value of the proposalID in the response.

  • If the number of replies is less than half, try updating to generate a larger proposaID, then go back to the preparation phase and re-execute.

4. An Acceptor makes the following judgments upon receiving an Accept request

  • If the proposalID received >= the proposalID of the persistent MAX_proposalID, then the proposalID and value are persisted.

  • If the proposalID received is less than MAX_proposalID, no response is received or the response submission fails.

Proposer collects some accept responses after a period of time

  • If the number of responses exceeds half the number of acceptors, then the value is submitted successfully, and a broadcast is sent to all proposers, and Learner. Notify them of the value that has been submitted.

  • If the number of replies is less than = half the number of acceptors, then try updating a larger proposalID and move to the prepare phase.

  • If a reply is received that the submission failed, it also tries to update the larger proposalID and also goes to the prepare phase.

03,

The Proposer sends a prepare and accept request

The first prepare request is to find the Proposer with the largest numbered proposalID,

The second accept request sends the value of the proposalID with the largest Proposer to all proposers and to the Learner.