etcdserver: do not applySnapshot twice

This commit is contained in:
Xiang Li 2014-11-25 14:53:49 -08:00
parent 74d8c7f457
commit 01cbcce8ba
2 changed files with 2 additions and 1 deletions

View File

@ -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
}

View File

@ -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)