mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: apply entries when it is not empty
Or it updates appliedi wrongly.
This commit is contained in:
parent
6bfa5d409e
commit
7e06d85651
@ -455,8 +455,10 @@ func (s *EtcdServer) run() {
|
||||
if appliedi+1-firsti < uint64(len(rd.CommittedEntries)) {
|
||||
ents = rd.CommittedEntries[appliedi+1-firsti:]
|
||||
}
|
||||
if appliedi, shouldstop = s.apply(ents); shouldstop {
|
||||
return
|
||||
if len(ents) > 0 {
|
||||
if appliedi, shouldstop = s.apply(ents); shouldstop {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -693,8 +695,9 @@ func getExpirationTime(r *pb.Request) time.Time {
|
||||
return t
|
||||
}
|
||||
|
||||
// apply takes an Entry received from Raft (after it has been committed) and
|
||||
// applies it to the current state of the EtcdServer
|
||||
// apply takes entries received from Raft (after it has been committed) and
|
||||
// applies them to the current state of the EtcdServer.
|
||||
// The given entries should not be empty.
|
||||
func (s *EtcdServer) apply(es []raftpb.Entry) (uint64, bool) {
|
||||
var applied uint64
|
||||
for i := range es {
|
||||
|
Loading…
x
Reference in New Issue
Block a user