mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #2349 from yichengq/327
rafthttp: fix panic on receiving empty ents
This commit is contained in:
commit
e54fdfd9cc
@ -54,7 +54,9 @@ func (er *entryReader) readEntries() ([]raftpb.Entry, error) {
|
||||
}
|
||||
er.ents.Add()
|
||||
}
|
||||
er.lastIndex.Set(int64(ents[l-1].Index))
|
||||
if l > 0 {
|
||||
er.lastIndex.Set(int64(ents[l-1].Index))
|
||||
}
|
||||
return ents, nil
|
||||
}
|
||||
|
||||
|
@ -295,6 +295,9 @@ func (s *streamReader) handle(r io.Reader) {
|
||||
}
|
||||
return
|
||||
}
|
||||
if len(ents) == 0 {
|
||||
continue
|
||||
}
|
||||
// The commit index field in appendEntry message is not recovered.
|
||||
// The follower updates its commit index through heartbeat.
|
||||
msg := raftpb.Message{
|
||||
|
Loading…
x
Reference in New Issue
Block a user