zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mahadev Konar <maha...@apache.org>
Subject Re: discarded messages seems will exists in some follower, when the leader failed.
Date Thu, 07 Apr 2011 03:21:44 GMT
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 <wjiangwen@gmail.com> 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

Mime
View raw message