mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: set applied index correctly
This commit is contained in:
parent
04155423f5
commit
2d761d64a4
@ -1044,6 +1044,7 @@ func (s *EtcdServer) applyEntryNormal(e *raftpb.Entry) {
|
|||||||
s.consistIndex.setConsistentIndex(e.Index)
|
s.consistIndex.setConsistentIndex(e.Index)
|
||||||
shouldApplyV3 = true
|
shouldApplyV3 = true
|
||||||
}
|
}
|
||||||
|
defer s.setAppliedIndex(e.Index)
|
||||||
|
|
||||||
// raft state machine may generate noop entry when leader confirmation.
|
// raft state machine may generate noop entry when leader confirmation.
|
||||||
// skip it in advance to avoid some potential bug in the future
|
// skip it in advance to avoid some potential bug in the future
|
||||||
@ -1082,7 +1083,6 @@ func (s *EtcdServer) applyEntryNormal(e *raftpb.Entry) {
|
|||||||
if s.w.IsRegistered(id) || !noSideEffect(&raftReq) {
|
if s.w.IsRegistered(id) || !noSideEffect(&raftReq) {
|
||||||
ar = s.applyV3.Apply(&raftReq)
|
ar = s.applyV3.Apply(&raftReq)
|
||||||
}
|
}
|
||||||
s.setAppliedIndex(e.Index)
|
|
||||||
|
|
||||||
if ar == nil {
|
if ar == nil {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user