Closed xiang90 closed 10 years ago
I think in general, we should check whether or not s.state == state
and return it at very first time. But it seems that the function also takes charge of reporting leader change, so I am unsure about it.
@unihorn We can do that, but I would rather make that happen in another refactor pull request.
But if it doesn't impact the leader change report, we could make do the s.state == state
check and return it if false at the start of this function. I think that could make logic easier.
@unihorn Updated. How about this?
@xiangli-cmu Could it be in Snapshotting
state when processAppendEntriesRequest
? If so, the if condition should consider about this also.
@unihorn Only candidate
should step-down to follower
. Both follower
and snapshotting
should be as same as it is.
@xiangli-cmu lgtm then!
Fix a bug introduced by race fix. The setState function will be called even if there is no actual stateChange. Check the previous state before dispatching the event.