The commit is not actually written to the log. The log is updated before a
server ACKs a proposal - and what's in the log is what matters for
recovery.
In your example, server1 sent a commit for p2, so it got at least one ACK
from server2 or server3. Since in your example server2 has been elected, it
has the longest log,
so it has to have p2 in the log.  So p2 is going to be committed by
NEWLEADER.

I might not be remembering this completely accurately, hope someone can
correct me if I missed something.


On Sat, Jul 27, 2019 at 5:23 AM chen dongming <[email protected]> wrote:

> hi,
>
> I have a question about zab.
>
> server1(leader): p1, p2, c1, c2
>
> server2:p1, p2,c1
>
> server3:p1,p2
>
> At this time, server1 is down, server2 become leader.
>
> I read the code of LearnerHandler.java, I think p1, p2 in server3 can be
> committed by DIFF, NEWLEADER.
>
> But when is p2 in server2 committed?
>
>
>

Reply via email to