RaftActorBehavior behavior = currentBehavior.getDelegate();
if(behavior instanceof Follower) {
String previousLeaderId = ((Follower)behavior).getLeaderId();
+ short previousLeaderPayloadVersion = behavior.getLeaderPayloadVersion();
LOG.debug("{}: Re-initializing to Follower with previous leaderId {}", persistenceId(), previousLeaderId);
- changeCurrentBehavior(new Follower(context, previousLeaderId));
+ changeCurrentBehavior(new Follower(context, previousLeaderId, previousLeaderPayloadVersion));
} else {
initializeBehavior();
}
private static final int SYNC_THRESHOLD = 10;
public Follower(RaftActorContext context) {
- this(context, null);
+ this(context, null, (short)-1);
}
- public Follower(RaftActorContext context, String initialLeaderId) {
+ public Follower(RaftActorContext context, String initialLeaderId, short initialLeaderPayloadVersion) {
super(context, RaftState.Follower);
leaderId = initialLeaderId;
+ setLeaderPayloadVersion(initialLeaderPayloadVersion);
initialSyncStatusTracker = new SyncStatusTracker(context.getActor(), getId(), SYNC_THRESHOLD);