mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: fix pendingConf
This commit is contained in:
parent
c03fbf68d6
commit
d293c4915c
@ -203,6 +203,7 @@ func (sm *stateMachine) becomeFollower(term, lead int) {
|
|||||||
sm.term = term
|
sm.term = term
|
||||||
sm.lead = lead
|
sm.lead = lead
|
||||||
sm.state = stateFollower
|
sm.state = stateFollower
|
||||||
|
sm.pendingConf = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *stateMachine) becomeCandidate() {
|
func (sm *stateMachine) becomeCandidate() {
|
||||||
@ -224,6 +225,12 @@ func (sm *stateMachine) becomeLeader() {
|
|||||||
sm.reset()
|
sm.reset()
|
||||||
sm.lead = sm.addr
|
sm.lead = sm.addr
|
||||||
sm.state = stateLeader
|
sm.state = stateLeader
|
||||||
|
|
||||||
|
for _, e := range sm.log.ents[sm.log.committed:] {
|
||||||
|
if e.Type == config {
|
||||||
|
sm.pendingConf = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *stateMachine) Msgs() []Message {
|
func (sm *stateMachine) Msgs() []Message {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user