[
https://issues.apache.org/jira/browse/ZOOKEEPER-1343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13175815#comment-13175815
]
Flavio Junqueira commented on ZOOKEEPER-1343:
---------------------------------------------
I'm not sure I'm following you. Here is how I see it:
# The call to peer.setAcceptedEpoch(5) sets the value of
QuorumPeer.acceptedEpoch to 5. The value 5 was arbitrarily chosen, of course.
# The call to leader.start() will invoke Leader.lead(), which will invoke
getEpochToPropose() and will set the value of Leader.epoch to 5 (initial value
of Leader.epoch is -1). The leader thread will block in getEpochToPropose()
until a quorum runs getEpochToPropose().
# The mock follower executes getEpochToPropose(1,6). Since the leader + this
follower form a quorum, both are able to continue and complete the execution of
getEpochToPropose(). Without the fix, the value of Leader.epoch won't be 7 as
it should be after the call of getEpochToPropose() from the mock follower.
This is the flow I believe we have with the current test, and I think that
multiple consecutive calls of getEpochToPropose() from the leader are not
possible because the leader will block in the first call until it gets a
quorum.
> getEpochToPropose should check if lastAcceptedEpoch is greater or equal than
> epoch
> ----------------------------------------------------------------------------------
>
> Key: ZOOKEEPER-1343
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1343
> Project: ZooKeeper
> Issue Type: Bug
> Affects Versions: 3.4.0
> Reporter: Flavio Junqueira
> Assignee: Flavio Junqueira
> Fix For: 3.5.0
>
> Attachments: ZOOKEEPER-1343.patch
>
>
> The following block in Leader.getEpochToPropose:
> {noformat}
> if (lastAcceptedEpoch > epoch) {
> epoch = lastAcceptedEpoch+1;
> }
> {noformat}
> needs to be fixed, since it doesn't increment the epoch variable in the case
> epoch != -1 (initial value) and lastAcceptedEpoch is equal. The fix trivial
> and corresponds to changing > with >=.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira