mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: better logging for leader transition
This commit is contained in:
parent
83ca16188c
commit
46ebf69c02
@ -219,13 +219,18 @@ func (n *node) run(r *raft) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if rd.SoftState != nil && lead != rd.SoftState.Lead {
|
if rd.SoftState != nil && lead != rd.SoftState.Lead {
|
||||||
log.Printf("raft: leader changed from %x to %x", lead, rd.SoftState.Lead)
|
|
||||||
lead = rd.SoftState.Lead
|
|
||||||
if r.hasLeader() {
|
if r.hasLeader() {
|
||||||
|
if lead == None {
|
||||||
|
log.Printf("raft: elected leader %x at term %d", rd.SoftState.Lead, r.Term)
|
||||||
|
} else {
|
||||||
|
log.Printf("raft: leader changed from %x to %x at term %d", lead, rd.SoftState.Lead, r.Term)
|
||||||
|
}
|
||||||
propc = n.propc
|
propc = n.propc
|
||||||
} else {
|
} else {
|
||||||
|
log.Printf("raft: lost leader %x at term %d", lead, r.Term)
|
||||||
propc = nil
|
propc = nil
|
||||||
}
|
}
|
||||||
|
lead = rd.SoftState.Lead
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user