mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: save snapshot only if the index is greater than previous snap index
This commit is contained in:
parent
4b7af29c37
commit
453133977d
@ -395,10 +395,11 @@ func (s *EtcdServer) run() {
|
||||
if err := s.storage.Save(rd.HardState, rd.Entries); err != nil {
|
||||
log.Fatalf("etcdserver: save state and entries error: %v", err)
|
||||
}
|
||||
if !raft.IsEmptySnap(rd.Snapshot) {
|
||||
if !raft.IsEmptySnap(rd.Snapshot) && rd.Snapshot.Metadata.Index > snapi {
|
||||
if err := s.storage.SaveSnap(rd.Snapshot); err != nil {
|
||||
log.Fatalf("etcdserver: create snapshot error: %v", err)
|
||||
}
|
||||
snapi = rd.Snapshot.Metadata.Index
|
||||
}
|
||||
s.sendhub.Send(rd.Messages)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user