mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: do not applySnapshot twice
This commit is contained in:
parent
74d8c7f457
commit
01cbcce8ba
@ -394,7 +394,6 @@ func (s *EtcdServer) run() {
|
||||
if err := s.storage.SaveSnap(rd.Snapshot); err != nil {
|
||||
log.Fatalf("etcdserver: create snapshot error: %v", err)
|
||||
}
|
||||
s.raftStorage.ApplySnapshot(rd.Snapshot)
|
||||
snapi = rd.Snapshot.Metadata.Index
|
||||
}
|
||||
|
||||
|
@ -245,6 +245,8 @@ func (l *raftLog) maybeCommit(maxIndex, term uint64) bool {
|
||||
}
|
||||
|
||||
func (l *raftLog) restore(s pb.Snapshot) {
|
||||
// TODO: rethink restore logic.
|
||||
// This breaks the rule that raft never modifies storage.
|
||||
err := l.storage.ApplySnapshot(s)
|
||||
if err != nil {
|
||||
panic(err) // TODO(bdarnell)
|
||||
|
Loading…
x
Reference in New Issue
Block a user