Merge pull request #9458 from gyuho/pre-vote

functional-tester: test pre-vote in functional-tester
release-3.4
Gyuho Lee 2018-03-19 09:26:17 -07:00 committed by GitHub
commit dea71f32f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 33 deletions

View File

@ -107,8 +107,6 @@ func init() {
// Config holds the arguments for configuring an etcd server.
type Config struct {
// member
CorsInfo *cors.CORSInfo
LPUrls, LCUrls []url.URL
Dir string `json:"data-dir"`
@ -135,8 +133,6 @@ type Config struct {
MaxTxnOps uint `json:"max-txn-ops"`
MaxRequestBytes uint `json:"max-request-bytes"`
// gRPC server options
// GRPCKeepAliveMinTime is the minimum interval that a client should
// wait before pinging server. When client pings "too fast", server
// sends goaway and closes the connection (errors: too_many_pings,
@ -152,8 +148,6 @@ type Config struct {
// before closing a non-responsive connection. 0 to disable.
GRPCKeepAliveTimeout time.Duration `json:"grpc-keepalive-timeout"`
// clustering
APUrls, ACUrls []url.URL
ClusterState string `json:"initial-cluster-state"`
DNSCluster string `json:"discovery-srv"`
@ -165,7 +159,12 @@ type Config struct {
StrictReconfigCheck bool `json:"strict-reconfig-check"`
EnableV2 bool `json:"enable-v2"`
// security
// PreVote 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: enable by default in 3.5.
PreVote bool `json:"pre-vote"`
ClientTLSInfo transport.TLSInfo
ClientAutoTLS bool
@ -198,8 +197,6 @@ type Config struct {
// - https://github.com/coreos/etcd/issues/9353
HostWhitelist []string `json:"host-whitelist"`
// debug
Debug bool `json:"debug"`
LogPkgLevels string `json:"log-package-levels"`
LogOutput string `json:"log-output"`
@ -225,22 +222,11 @@ type Config struct {
// embed.StartEtcd(cfg)
ServiceRegister func(*grpc.Server) `json:"-"`
// auth
AuthToken string `json:"auth-token"`
// Experimental flags
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
@ -300,7 +286,7 @@ func NewConfig() *Config {
EnableV2: DefaultEnableV2,
HostWhitelist: defaultHostWhitelist,
AuthToken: "simple",
ExperimentalPreVote: false, // TODO: enable by default in v3.5
PreVote: false, // TODO: enable by default in v3.5
}
cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)
return cfg

View File

@ -171,7 +171,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
AuthToken: cfg.AuthToken,
InitialCorruptCheck: cfg.ExperimentalInitialCorruptCheck,
CorruptCheckTime: cfg.ExperimentalCorruptCheckTime,
PreVote: cfg.ExperimentalPreVote,
PreVote: cfg.PreVote,
Debug: cfg.Debug,
}

View File

@ -162,11 +162,10 @@ func newConfig() *config {
fs.BoolVar(&cfg.ec.StrictReconfigCheck, "strict-reconfig-check", cfg.ec.StrictReconfigCheck, "Reject reconfiguration requests that would cause quorum loss.")
fs.BoolVar(&cfg.ec.EnableV2, "enable-v2", cfg.ec.EnableV2, "Accept etcd V2 client requests.")
fs.StringVar(&cfg.ec.ExperimentalEnableV2V3, "experimental-enable-v2v3", cfg.ec.ExperimentalEnableV2V3, "v3 prefix for serving emulated v2 state.")
fs.BoolVar(&cfg.ec.PreVote, "pre-vote", cfg.ec.PreVote, "Enable to run an additional Raft election phase.")
// proxy
fs.Var(cfg.cf.proxy, "proxy", fmt.Sprintf("Valid values include %q", cfg.cf.proxy.Valids()))
fs.UintVar(&cfg.cp.ProxyFailureWaitMs, "proxy-failure-wait", cfg.cp.ProxyFailureWaitMs, "Time (in milliseconds) an endpoint will be held in a failed state.")
fs.UintVar(&cfg.cp.ProxyRefreshIntervalMs, "proxy-refresh-interval", cfg.cp.ProxyRefreshIntervalMs, "Time (in milliseconds) of the endpoints refresh interval.")
fs.UintVar(&cfg.cp.ProxyDialTimeoutMs, "proxy-dial-timeout", cfg.cp.ProxyDialTimeoutMs, "Time (in milliseconds) for a dial to timeout.")
@ -217,7 +216,7 @@ func newConfig() *config {
// experimental
fs.BoolVar(&cfg.ec.ExperimentalInitialCorruptCheck, "experimental-initial-corrupt-check", cfg.ec.ExperimentalInitialCorruptCheck, "Enable to check data corruption before serving any client/peer traffic.")
fs.DurationVar(&cfg.ec.ExperimentalCorruptCheckTime, "experimental-corrupt-check-time", cfg.ec.ExperimentalCorruptCheckTime, "Duration of time between cluster corruption check passes.")
fs.BoolVar(&cfg.ec.ExperimentalPreVote, "experimental-pre-vote", cfg.ec.ExperimentalPreVote, "Enable to run an additional Raft election phase.")
fs.StringVar(&cfg.ec.ExperimentalEnableV2V3, "experimental-enable-v2v3", cfg.ec.ExperimentalEnableV2V3, "v3 prefix for serving emulated v2 state.")
// ignored
for _, f := range cfg.ignored {

View File

@ -104,6 +104,8 @@ clustering flags:
suffix to the dns srv name queried when bootstrapping.
--strict-reconfig-check '` + strconv.FormatBool(embed.DefaultStrictReconfigCheck) + `'
reject reconfiguration requests that would cause quorum loss.
--pre-vote 'false'
enable to run an additional Raft election phase.
--auto-compaction-retention '0'
auto compaction retention length. 0 means disable auto compaction.
--auto-compaction-mode 'periodic'
@ -111,8 +113,7 @@ clustering flags:
--enable-v2 '` + strconv.FormatBool(embed.DefaultEnableV2) + `'
Accept etcd V2 client requests.
proxy flags:
"proxy" supports v2 API only.
proxy flags (v2 API only):
--proxy 'off'
proxy mode setting ('off', 'readonly' or 'on').
@ -127,7 +128,6 @@ proxy flags:
--proxy-read-timeout 0
time (in milliseconds) for a read to timeout.
security flags:
--ca-file '' [DEPRECATED]
@ -197,7 +197,5 @@ experimental flags:
duration of time between cluster corruption check passes.
--experimental-enable-v2v3 ''
serve v2 requests through the v3 backend under a given prefix.
--experimental-pre-vote 'false'
enable to run an additional Raft election phase.
`
)

View File

@ -82,7 +82,7 @@ func (c *cluster) bootstrap() error {
m.Flags(),
"--initial-cluster-token", token,
"--initial-cluster", clusterStr,
"--snapshot-count", "10000")
)
if _, err := m.Agent.Start(flags...); err != nil {
// cleanup

View File

@ -49,6 +49,8 @@ func (m *member) Flags() []string {
"--listen-peer-urls", m.PeerURL,
"--initial-advertise-peer-urls", m.AdvertisePeerURL,
"--initial-cluster-state", "new",
"--snapshot-count", "10000",
"--pre-vote",
"--experimental-initial-corrupt-check",
}
}
@ -76,7 +78,7 @@ func (m *member) CheckCompact(rev int64) error {
}
func (m *member) Defrag() error {
plog.Printf("defragmenting %s\n", m.AdvertiseClientURL)
plog.Printf("defragmenting %s", m.AdvertiseClientURL)
cli, err := m.newClientV3()
if err != nil {
return err
@ -88,7 +90,7 @@ func (m *member) Defrag() error {
if err != nil {
return err
}
plog.Printf("defragmented %s\n", m.AdvertiseClientURL)
plog.Printf("defragmented %s", m.AdvertiseClientURL)
return nil
}