Hi,

That's a good question. So if I understand correctly, you are asking what
happens if there is a new Leader Election in ZooKeeper, what is the "last
seen zxid". I checked the ZAB protocol, it is not entirely clear for me as
well, but my understanding is that the last seen zxid is the last
transaction, which is read from txnlogs in case of a recovery. Honestly,
there's nothing else this could be read from. So if it hasn't been
committed to the datatree (and that exists in memory anyway, at least until
a snapshot is taken), it is still the last txn that is logged by one of the
followers, so he will win the Leader Election, and the followers will get
this txn as well.
Anyone agree/disagree? :)

Regards,
Norbert

On Mon, Sep 2, 2019 at 4:50 AM 121476...@qq.com <121476...@qq.com> wrote:

> hi, i'm a new to zookeeper, and this problem confuses me for nearly two
> months...
> papers tell me that zab must satisfy:
> A message delivered by one sever must be delivered on quorum.
> A message skipped must always be skipped.
> Then consider two cases below, L is short for leader, F is short for
> follower, p is short for proposal.
> Case1:
> L send p1 to F2 F3 F4 F5.
> F2 F3 ack p1, reach a quorum.
> L1 is about to send commit but failed...
> L2 become new leader, he should commit.
>
> Case2:
> L1 send p1 to F2 F3 F4 F5.
> Only F2 ack p1, not reach a quorum.
> Then L1 failed...
> L2 become new leader, he should skip p1.
>
> i think L2 should handle the cases in election&recovery phase. but how L2
> can know the global state and decide if commit p1 or skip p1?
> if anyone helps, i will be much appreciate.
>
>
>
> 121476...@qq.com
>

Reply via email to