Todd Lipcon has submitted this change and it was merged.

Change subject: KUDU-1365. Add leader pre-elections

KUDU-1365. Add leader pre-elections

This implements the "pre-election" extension to the Raft algorithm.
The idea is that, before calling a leader election, a candidate first
sends a pre-election vote request to all voters. The voters respond
as they would have in a real vote, except they don't actually record
their vote.

Cluster tests verify that this substantially reduces the election storms
after a node has a temporarily slow disk or otherwise freezes.

A new experimental flag 'raft_enable_pre_election' is introduced which
defaults the feature to on, but provides a safety valve to disable this
in case we find some bug after release.

Tested this patch (along with the following series of cleanups) with:
 [1] 1000 loops of RaftConsensusITest.MultiThreadedInsertWithFailovers
 [2] 500 loops of raft-consensus-itest overall
 [3] 1000 loops of exactly_once_writes-itest

The above tests have usually been pretty good about finding bugs in
consensus in the past.


Change-Id: Ifcfabd8c9ffe31f17ab768542a046426f656db43
Tested-by: Kudu Jenkins
Reviewed-by: David Ribeiro Alves <>
M src/kudu/consensus/consensus.h
M src/kudu/consensus/consensus.proto
M src/kudu/consensus/
M src/kudu/consensus/
M src/kudu/consensus/leader_election.h
M src/kudu/consensus/
M src/kudu/consensus/raft_consensus.h
M src/kudu/consensus/
M src/kudu/integration-tests/
M src/kudu/tserver/
10 files changed, 309 insertions(+), 144 deletions(-)

  David Ribeiro Alves: Looks good to me, approved
  Kudu Jenkins: Verified

To view, visit
To unsubscribe, visit

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifcfabd8c9ffe31f17ab768542a046426f656db43
Gerrit-PatchSet: 6
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <>
Gerrit-Reviewer: David Ribeiro Alves <>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <>

Reply via email to