mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: remove duplicate "setAppliedIndex" calls
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
4f754c1850
commit
509cf414f7
@ -155,8 +155,8 @@ func (ms *maintenanceServer) Status(ctx context.Context, ar *pb.StatusRequest) (
|
||||
DbSize: ms.bg.Backend().Size(),
|
||||
Leader: uint64(ms.rg.Leader()),
|
||||
RaftIndex: ms.rg.CommittedIndex(),
|
||||
RaftTerm: ms.rg.Term(),
|
||||
RaftAppliedIndex: ms.rg.AppliedIndex(),
|
||||
RaftTerm: ms.rg.Term(),
|
||||
DbSizeInUse: ms.bg.Backend().SizeInUse(),
|
||||
}
|
||||
if uint64(ms.rg.Leader()) == raft.None {
|
||||
|
@ -1392,6 +1392,8 @@ func (s *EtcdServer) apply(es []raftpb.Entry, confState *raftpb.ConfState) (appl
|
||||
switch e.Type {
|
||||
case raftpb.EntryNormal:
|
||||
s.applyEntryNormal(&e)
|
||||
s.setAppliedIndex(e.Index)
|
||||
s.setTerm(e.Term)
|
||||
case raftpb.EntryConfChange:
|
||||
// set the consistent index of current executing entry
|
||||
if e.Index > s.consistIndex.ConsistentIndex() {
|
||||
@ -1401,15 +1403,13 @@ func (s *EtcdServer) apply(es []raftpb.Entry, confState *raftpb.ConfState) (appl
|
||||
pbutil.MustUnmarshal(&cc, e.Data)
|
||||
removedSelf, err := s.applyConfChange(cc, confState)
|
||||
s.setAppliedIndex(e.Index)
|
||||
s.setTerm(e.Term)
|
||||
shouldStop = shouldStop || removedSelf
|
||||
s.w.Trigger(cc.ID, &confChangeResponse{s.cluster.Members(), err})
|
||||
default:
|
||||
plog.Panicf("entry type should be either EntryNormal or EntryConfChange")
|
||||
}
|
||||
atomic.StoreUint64(&s.appliedIndex, e.Index)
|
||||
atomic.StoreUint64(&s.term, e.Term)
|
||||
appliedt = e.Term
|
||||
appliedi = e.Index
|
||||
appliedi, appliedt = e.Index, e.Term
|
||||
}
|
||||
return appliedt, appliedi, shouldStop
|
||||
}
|
||||
@ -1422,7 +1422,6 @@ func (s *EtcdServer) applyEntryNormal(e *raftpb.Entry) {
|
||||
s.consistIndex.setConsistentIndex(e.Index)
|
||||
shouldApplyV3 = true
|
||||
}
|
||||
defer s.setAppliedIndex(e.Index)
|
||||
|
||||
// raft state machine may generate noop entry when leader confirmation.
|
||||
// skip it in advance to avoid some potential bug in the future
|
||||
|
Loading…
x
Reference in New Issue
Block a user