Skip to content

Commit

Permalink
etcdserver: commit before sending snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
xiang90 committed Jul 3, 2016
1 parent 7cc4596 commit 8a8a825
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions etcdserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1170,8 +1170,7 @@ func (s *EtcdServer) snapshot(snapi uint64, confState raftpb.ConfState) {
}
plog.Panicf("unexpected create snapshot error %v", err)
}
// commit v3 storage because WAL file before snapshot index
// could be removed after SaveSnap.
// commit kv to write metadata (for example: consistent index) to disk.
s.KV().Commit()
// SaveSnap saves the snapshot and releases the locked wal files
// to the snapshot index.
Expand Down
2 changes: 2 additions & 0 deletions etcdserver/snapshot_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func (s *EtcdServer) createMergedSnapshotMessage(m raftpb.Message, snapi uint64,
plog.Panicf("store save should never fail: %v", err)
}

// commit kv to write metadata(for example: consistent index).
s.KV().Commit()
dbsnap := s.be.Snapshot()
// get a snapshot of v3 KV as readCloser
rc := newSnapshotReaderCloser(dbsnap)
Expand Down

0 comments on commit 8a8a825

Please sign in to comment.