mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #2713 from xiaost/etcdserver-skip-empty-entry
etcdserver: apply: skip empty Entry
This commit is contained in:
commit
b5d4d9ae9b
@ -669,6 +669,11 @@ func (s *EtcdServer) apply(es []raftpb.Entry, confState *raftpb.ConfState) (uint
|
|||||||
e := es[i]
|
e := es[i]
|
||||||
switch e.Type {
|
switch e.Type {
|
||||||
case raftpb.EntryNormal:
|
case raftpb.EntryNormal:
|
||||||
|
// raft state machine may generate noop entry when leader confirmation.
|
||||||
|
// skip it in advance to avoid some potential bug in the future
|
||||||
|
if len(e.Data) == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
var r pb.Request
|
var r pb.Request
|
||||||
pbutil.MustUnmarshal(&r, e.Data)
|
pbutil.MustUnmarshal(&r, e.Data)
|
||||||
s.w.Trigger(r.ID, s.applyRequest(r))
|
s.w.Trigger(r.ID, s.applyRequest(r))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user