mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: directly update leader in advance
This makes the alternative option of implementing the leader's self-ack of entry append the default. Signed-off-by: Tobias Grieger <tobias.b.grieger@gmail.com>
This commit is contained in:
parent
894e5cb685
commit
67c3522893
10
raft/raft.go
10
raft/raft.go
@ -576,11 +576,11 @@ func (r *raft) advance(rd Ready) {
|
|||||||
// The leader needs to self-ack the entries just appended (since it doesn't
|
// The leader needs to self-ack the entries just appended (since it doesn't
|
||||||
// send an MsgApp to itself). This is roughly equivalent to:
|
// send an MsgApp to itself). This is roughly equivalent to:
|
||||||
//
|
//
|
||||||
// r.prs.Progress[r.id].MaybeUpdate(e.Index)
|
r.prs.Progress[r.id].MaybeUpdate(e.Index)
|
||||||
// if r.maybeCommit() {
|
if r.maybeCommit() {
|
||||||
// r.bcastAppend()
|
r.bcastAppend()
|
||||||
// }
|
}
|
||||||
_ = r.Step(pb.Message{From: r.id, Type: pb.MsgAppResp, Index: e.Index})
|
// _ = r.Step(pb.Message{From: r.id, Type: pb.MsgAppResp, Index: e.Index})
|
||||||
}
|
}
|
||||||
// NB: it's important for performance that this call happens after
|
// NB: it's important for performance that this call happens after
|
||||||
// r.Step above on the leader. This is because r.Step can then use
|
// r.Step above on the leader. This is because r.Step can then use
|
||||||
|
Loading…
x
Reference in New Issue
Block a user