mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: support Raft Pre-Vote
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
8aae8c1c9c
commit
78918848bd
@ -76,6 +76,9 @@ type ServerConfig struct {
|
|||||||
InitialCorruptCheck bool
|
InitialCorruptCheck bool
|
||||||
CorruptCheckTime time.Duration
|
CorruptCheckTime time.Duration
|
||||||
|
|
||||||
|
// PreVote is true to enable Raft Pre-Vote.
|
||||||
|
PreVote bool
|
||||||
|
|
||||||
Debug bool
|
Debug bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,6 +411,7 @@ func startNode(cfg ServerConfig, cl *membership.RaftCluster, ids []types.ID) (id
|
|||||||
MaxSizePerMsg: maxSizePerMsg,
|
MaxSizePerMsg: maxSizePerMsg,
|
||||||
MaxInflightMsgs: maxInflightMsgs,
|
MaxInflightMsgs: maxInflightMsgs,
|
||||||
CheckQuorum: true,
|
CheckQuorum: true,
|
||||||
|
PreVote: cfg.PreVote,
|
||||||
}
|
}
|
||||||
|
|
||||||
n = raft.StartNode(c, peers)
|
n = raft.StartNode(c, peers)
|
||||||
@ -445,6 +446,7 @@ func restartNode(cfg ServerConfig, snapshot *raftpb.Snapshot) (types.ID, *member
|
|||||||
MaxSizePerMsg: maxSizePerMsg,
|
MaxSizePerMsg: maxSizePerMsg,
|
||||||
MaxInflightMsgs: maxInflightMsgs,
|
MaxInflightMsgs: maxInflightMsgs,
|
||||||
CheckQuorum: true,
|
CheckQuorum: true,
|
||||||
|
PreVote: cfg.PreVote,
|
||||||
}
|
}
|
||||||
|
|
||||||
n := raft.RestartNode(c)
|
n := raft.RestartNode(c)
|
||||||
@ -501,6 +503,7 @@ func restartAsStandaloneNode(cfg ServerConfig, snapshot *raftpb.Snapshot) (types
|
|||||||
MaxSizePerMsg: maxSizePerMsg,
|
MaxSizePerMsg: maxSizePerMsg,
|
||||||
MaxInflightMsgs: maxInflightMsgs,
|
MaxInflightMsgs: maxInflightMsgs,
|
||||||
CheckQuorum: true,
|
CheckQuorum: true,
|
||||||
|
PreVote: cfg.PreVote,
|
||||||
}
|
}
|
||||||
n := raft.RestartNode(c)
|
n := raft.RestartNode(c)
|
||||||
raftStatus = n.Status
|
raftStatus = n.Status
|
||||||
|
@ -258,6 +258,12 @@ type EtcdServer struct {
|
|||||||
// NewServer creates a new EtcdServer from the supplied configuration. The
|
// NewServer creates a new EtcdServer from the supplied configuration. The
|
||||||
// configuration is considered static for the lifetime of the EtcdServer.
|
// configuration is considered static for the lifetime of the EtcdServer.
|
||||||
func NewServer(cfg ServerConfig) (srv *EtcdServer, err error) {
|
func NewServer(cfg ServerConfig) (srv *EtcdServer, err error) {
|
||||||
|
if cfg.PreVote {
|
||||||
|
plog.Info("Raft Pre-Vote is enabled")
|
||||||
|
} else {
|
||||||
|
plog.Info("Raft Pre-Vote is disabled")
|
||||||
|
}
|
||||||
|
|
||||||
st := v2store.New(StoreClusterPrefix, StoreKeysPrefix)
|
st := v2store.New(StoreClusterPrefix, StoreKeysPrefix)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user