Vladislav Shpilevoy
authored
If Raft state machine sees the current leader has explicitly resigned from its role, it starts a new election round right away. But in the code starting a new round there was an assumption that there is no a volatile state. There was, in fact. The patch makes the election start code use the volatile state to bump the term. It should be safe, because the other nodes won't receive it anyway until the new term is persisted. There was an alternative - do not schedule new election until the current WAL write ends. It wasn't done, because would achieve the same (the term would be bumped and persisted) but with bigger a latency. Another reason is that if the leader would appear and resign during WAL write on another candidate, in the end of its WAL write the latter would see 0 leader and would think this term didn't have one yet. And would try to elect self now, in the current term. It makes little sense, because it won't win - the current term had already had a leader and the majority of votes is already taken. Closes #6129
Name | Last commit | Last update |
---|