mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: memory storage does not append out of date entries
This commit is contained in:
@@ -182,6 +182,10 @@ func (ms *MemoryStorage) Append(entries []pb.Entry) {
|
||||
return
|
||||
}
|
||||
offset := entries[0].Index - ms.snapshot.Metadata.Index
|
||||
// do not append out of date entries
|
||||
if offset < 0 {
|
||||
return
|
||||
}
|
||||
if uint64(len(ms.ents)) >= offset {
|
||||
ms.ents = ms.ents[:offset]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user