Skip to content

fix: use MsgHup instead of MsgTimeoutNow for timeout_now

Georgy Moshkin requested to merge gmoshkin/promote_or_fail-flakiness into master

Summary

  • fix: use MsgHup instead of MsgTimeoutNow for timeout_now

The problem is MsgTimeoutNow always results in a new election, because it explicitly ignores the pre_vote step. This results in integration test flakiness whenever a follower calls promote_or_fail while the leader's raft log is longer.

Контекст:

см. https://github.com/tikv/raft-rs/blob/2aefbf627f243dd261b7585ef1250d32efd9dfe7/src/raft.rs#L2380-L2383

            MessageType::MsgTimeoutNow => {
                if self.promotable {
                    info!(...);
                    // Leadership transfers never use pre-vote even if self.pre_vote is true; we
                    // know we are not recovering from a partition so there is no need for the
                    // extra round trip.
                    self.hup(true);
  • Cherry-pick to: none
  • Docs follow-up: not necessary

Merge request reports