Skip to content

Commit

Permalink
Remove redundant fsync for WAL
Browse files Browse the repository at this point in the history
Because the hard state was already on disk after invocation of wal.Save
  • Loading branch information
mrkm4ntr committed May 27, 2021
1 parent 71934ff commit cd7a9b1
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions server/etcdserver/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,6 @@ func (r *raftNode) start(rh *raftReadyHandler) {
// gofail: var raftAfterSave struct{}

if !raft.IsEmptySnap(rd.Snapshot) {
// Force WAL to fsync its hard state before Release() releases
// old data from the WAL. Otherwise could get an error like:
// panic: tocommit(107) is out of range [lastIndex(84)]. Was the raft log corrupted, truncated, or lost?
// See https://github.com/etcd-io/etcd/issues/10219 for more details.
if err := r.storage.Sync(); err != nil {
r.lg.Fatal("failed to sync Raft snapshot", zap.Error(err))
}

// etcdserver now claim the snapshot has been persisted onto the disk
notifyc <- struct{}{}

Expand Down

0 comments on commit cd7a9b1

Please sign in to comment.