Hi Mahadev,

thanks for your answer!
the leader send TRUNC when the last ZXID in the follower is larger than the
max committed ZXID in the leader.
but in this case the last ZXID in the follower is 1,9 the max committed ZXID
in the leader is 2,1. So the leader will not send the TRUNC.
the following is the code in LeanerHandler:

 if (logTxns && (peerLastZxid >
leader.zk.getZKDatabase().getmaxCommittedLog())) {
                // this is the only case that we are sure that
                // we can ask the peer to truncate the log
                packetToSend = Leader.TRUNC;
                zxidToSend = leader.zk.getZKDatabase().getmaxCommittedLog();
                updates = zxidToSend;
            }

Sincerely



On Thu, Apr 7, 2011 at 11:21 AM, Mahadev Konar <[email protected]> wrote:

> Hi Jiangwen,
>  Take a look at :
>
>  syncWithLeader(newLeaderZxid);
>
> This method calls truncate to take care of the issue you mention.
>
> thanks
> mahadev
>
> On Tue, Apr 5, 2011 at 9:31 PM, jiangwen w <[email protected]> wrote:
> > discarded messages seems will exists in some follower, when the leader
> > failed. considering the following corner case:
> >
> > the latest committed proposals in the New Leader. the following is the
> > latest zxid list with  format: *<epoch>,<lower bits>*
> >  1,7
> >  1,8
> >  2,0
> >  2,1
> >
> > the last zxid in a follower
> > 1,7
> > 1,8
> > 1,9
> >
> > when the follower sync with the new leader, the transaction *1,9 *should
> be
> > truncated, but I couldn't found the code that can handle this case.
> > In this case the following code in LeanerHandler seems will be executed.
> >
> >   if (proposals.size() != 0) {
> >                    if ((leader.zk.getZKDatabase().getmaxCommittedLog() >=
> > peerLastZxid)
> >                            &&
> > (leader.zk.getZKDatabase().getminCommittedLog() <= peerLastZxid)) {
> >                        packetToSend = Leader.DIFF;
> >
> > Sincerely
> >
>
>
>
> --
> thanks
> mahadev
> @mahadevkonar
>

Reply via email to