You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by fish <fi...@163.com> on 2011/12/23 03:59:31 UTC
misgiving about quorm/lead.java 's getEpochToPropose function
Hi :
I am new to the zookeeper , I have just begin to read some code of zookeeper , but I don't quiet undestanding the quorm/lead.java 's getEpochToPropose method, In this function there is a statement
if (lastAcceptedEpoch > epoch) {
epoch = lastAcceptedEpoch+1;
}
My doubt is :
why use "lastAcceptedEpoch > epoch" but not "lastAcceptedEpoch >= epoch" here?
In my undestanding the lastAcceptedEpoch is the max epoch of a follower
may have accepted so when the lead have receive a accepted epoch from the follower it should always make it's own epoch larger than this one
Thanks .
Re: misgiving about quorm/lead.java 's getEpochToPropose function
Posted by Benjamin Reed <br...@apache.org>.
i agree. that is a bug. good catch fish! btw, we need to fix the tabs
in that function too!
ben
On Fri, Dec 23, 2011 at 4:57 AM, Flavio Junqueira <fp...@yahoo-inc.com> wrote:
> Alex and I discussed it a bit offline and it seems to be bug for us. I have
> created a jira (ZOOKEEPER-1343) and I'll try to get a patch out soon.
>
> Thanks for pointing it out!
>
> -Flavio
>
> On Dec 23, 2011, at 3:59 AM, fish wrote:
>
>> Hi :
>> I am new to the zookeeper , I have just begin to read some code of
>> zookeeper , but I don't quiet undestanding the quorm/lead.java 's
>> getEpochToPropose method, In this function there is a statement
>> if (lastAcceptedEpoch > epoch) {
>> epoch = lastAcceptedEpoch+1;
>> }
>> My doubt is :
>> why use "lastAcceptedEpoch > epoch" but not "lastAcceptedEpoch >=
>> epoch" here?
>>
>> In my undestanding the lastAcceptedEpoch is the max epoch of a follower
>> may have accepted so when the lead have receive a accepted epoch from the
>> follower it should always make it's own epoch larger than this one
>> Thanks .
>
>
> flavio
> junqueira
>
> research scientist
>
> fpj@yahoo-inc.com
> direct +34 93-183-8828
>
> avinguda diagonal 177, 8th floor, barcelona, 08018, es
> phone (408) 349 3300 fax (408) 349 3301
>
Re: misgiving about quorm/lead.java 's getEpochToPropose function
Posted by Flavio Junqueira <fp...@yahoo-inc.com>.
Alex and I discussed it a bit offline and it seems to be bug for us. I
have created a jira (ZOOKEEPER-1343) and I'll try to get a patch out
soon.
Thanks for pointing it out!
-Flavio
On Dec 23, 2011, at 3:59 AM, fish wrote:
> Hi :
> I am new to the zookeeper , I have just begin to read some code
> of zookeeper , but I don't quiet undestanding the quorm/lead.java
> 's getEpochToPropose method, In this function there is a statement
> if (lastAcceptedEpoch > epoch) {
> epoch = lastAcceptedEpoch+1;
> }
> My doubt is :
> why use "lastAcceptedEpoch > epoch" but not "lastAcceptedEpoch >=
> epoch" here?
>
> In my undestanding the lastAcceptedEpoch is the max epoch of a
> follower
> may have accepted so when the lead have receive a accepted epoch
> from the follower it should always make it's own epoch larger than
> this one
> Thanks .
flavio
junqueira
research scientist
fpj@yahoo-inc.com
direct +34 93-183-8828
avinguda diagonal 177, 8th floor, barcelona, 08018, es
phone (408) 349 3300 fax (408) 349 3301