From 3092d3bf7f731018ee6744fed9f0b15cd59ececc Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Fri, 23 Feb 2018 10:50:09 -0800 Subject: [PATCH] embed: add "ExperimentalPreVote" for Raft Signed-off-by: Gyuho Lee --- embed/config.go | 8 ++++++++ embed/etcd.go | 1 + 2 files changed, 9 insertions(+) diff --git a/embed/config.go b/embed/config.go index 2f4e9189c..b5ffbb13d 100644 --- a/embed/config.go +++ b/embed/config.go @@ -234,6 +234,13 @@ type Config struct { ExperimentalInitialCorruptCheck bool `json:"experimental-initial-corrupt-check"` ExperimentalCorruptCheckTime time.Duration `json:"experimental-corrupt-check-time"` ExperimentalEnableV2V3 string `json:"experimental-enable-v2v3"` + + // ExperimentalPreVote is true to enable Raft Pre-Vote. + // If enabled, Raft runs an additional election phase + // to check whether it would get enough votes to win + // an election, thus minimizing disruptions. + // TODO: change to "pre-vote" and enable by default in 3.5. + ExperimentalPreVote bool `json:"experimental-pre-vote"` } // configYAML holds the config suitable for yaml parsing @@ -293,6 +300,7 @@ func NewConfig() *Config { EnableV2: DefaultEnableV2, HostWhitelist: defaultHostWhitelist, AuthToken: "simple", + ExperimentalPreVote: false, // TODO: enable by default in v3.5 } cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name) return cfg diff --git a/embed/etcd.go b/embed/etcd.go index a034e04cc..78fbca461 100644 --- a/embed/etcd.go +++ b/embed/etcd.go @@ -171,6 +171,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) { AuthToken: cfg.AuthToken, InitialCorruptCheck: cfg.ExperimentalInitialCorruptCheck, CorruptCheckTime: cfg.ExperimentalCorruptCheckTime, + PreVote: cfg.ExperimentalPreVote, Debug: cfg.Debug, }