Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ type Config struct {
TickInterval typeutil.Duration `toml:"tick-interval"`
// ElectionInterval is the interval for etcd Raft election.
ElectionInterval typeutil.Duration `toml:"election-interval"`
// DisablePrevote is true to disable 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.
DisablePreVote bool `json:"disable-pre-vote"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using PreVote directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to enable it by default. use PreVote should distinguish whether the key exists in the TOML actually is false or not set it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, if not, use true directly.

We must explicitly set to false if we want to disable it.

Of course, you can add prevote=true in the example configuration.


Security SecurityConfig `toml:"security" json:"security"`

Expand Down Expand Up @@ -629,6 +634,7 @@ func (c *Config) genEmbedEtcdConfig() (*embed.Config, error) {
cfg.InitialCluster = c.InitialCluster
cfg.ClusterState = c.InitialClusterState
cfg.EnablePprof = true
cfg.PreVote = !c.DisablePreVote
cfg.StrictReconfigCheck = !c.disableStrictReconfigCheck
cfg.TickMs = uint(c.TickInterval.Duration / time.Millisecond)
cfg.ElectionMs = uint(c.ElectionInterval.Duration / time.Millisecond)
Expand Down