Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.5.5
-
None
-
None
Description
If the leader has been elected when the voting participant joins the cluster, then it can only act as followers. When Leader.getEpochToPropose is called, it does not participate in the voting. However, if the AcceptedEpoch is larger than the leader, it will never work properly.The status is as follows:LOOKING -> FOLLOWING -> exception -> LOOKING.
code as follows(Learner.registerWithLeader(int pktType)):
if (newEpoch > self.getAcceptedEpoch()){ wrappedEpochBytes.putInt((int)self.getCurrentEpoch()); self.setAcceptedEpoch(newEpoch); }else if (newEpoch == self.getAcceptedEpoch()){ // since we have already acked an epoch equal to the leaders, we cannot ack // again, but we still need to send our lastZxid to the leader so that we can // sync with it if it does assume leadership of the epoch. // the -1 indicates that this reply should not count as an ack for the new epoch wrappedEpochBytes.putInt(-1); }else{ throw new IOException("Leaders epoch, " + newEpoch + " is less than accepted epoch, " + self.getAcceptedEpoch()); }