Home > other >  ZAB agreement after the crash recovery questions about ZXID largest became the new leader
ZAB agreement after the crash recovery questions about ZXID largest became the new leader

Time:09-29

In the "from Paxos to Zookeeper distributed consistency principle and practice of" the book has the following paragraph:
As the leader, after receipt of the legal number of followers ACKs is broadcast to all the followers COMMIT command, at the same time, it can be carried in the local COMMIT and returned to the connection of the client (success), but if in each follower leader before receiving the COMMIT command will hang up and lead to the rest of the server did not perform this message,

How do you solve a transaction request has been processing (proposal) (commit) can't throw?

1, elections have maximum proposal (namely zxid maximum) of nodes as a new leader: because all proposals have been COMMIT must have a legitimate number of followers before an ACK, namely must have a legitimate number of server transaction log on a proposal for this proposal is, therefore, latest zxid is the largest data node to keep all the proposal by the COMMIT message status,

2, the new leader will own proposal in the transaction log but he didn't COMMIT the message processing,
3, the new leader and the follower to establish a fifo queue, will own the followers not proposal first sent to the follower, then the proposal of the COMMIT command sent to the follower, to ensure that all the followers to save all of the proposal, all followers to deal with all of the messages,

My question is: if the proposal from the old leader was less than half of the followers received hang up and then elected a new leader for the largest ZXID should be contain those who have not been submitted proposal, but the proposal has not been actually old leader submitted, the agreement is how to deal with this scenario?

CodePudding user response:

New leader will be in the recovery phase will ask if there is more than half of the flower received the proposal according to your scene, received no more than half of the flower, the new leader will give up this proposal will not be submitted

CodePudding user response:

Specific process can refer to this blog https://blog.csdn.net/gangsijay888/article/details/82383599 half part of [the] several leadership election scene analysis, analysis is very comprehensive

CodePudding user response:

reference 1st floor woyaodangti response:
new leader will be in the recovery phase will ask if there is more than half of the flower received the proposal according to your scene, received no more than half of the flower, the new leader will give up this proposal will not be submitted

It should be wrong, suppose you have the following scenario:
At some point, each node in the cluster as follows:
A: 1, 2, 3, 4
B: 1, 2, 3, 4
C: 1, 2, 3, 4
D: 1, 2, 3
E: 1, 2
Which is A leader. B, C, D, E, is follower
At this point A hang up for some reason, in theory we should guarantee has been submitted by 1, 2, 3, 4 message keep
C will be elected as leader in theory, but at this point in the cluster (B, C, D, E) 4, the message is not in the majority of nodes, if according to you submit the proposal will not do, that it has a problem, my conclusion is one of the largest cases, in zxid leader will gradually let each message is reached, not reject the proposal
  • Related