mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #4050 from xiang90/fsync
snap: call fsync before close db file
This commit is contained in:
commit
3f81f020c1
@ -32,6 +32,9 @@ func (s *Snapshotter) SaveDBFrom(r io.Reader, id uint64) error {
|
||||
return err
|
||||
}
|
||||
_, err = io.Copy(f, r)
|
||||
if err == nil {
|
||||
err = f.Sync()
|
||||
}
|
||||
f.Close()
|
||||
if err != nil {
|
||||
os.Remove(f.Name())
|
||||
|
Loading…
x
Reference in New Issue
Block a user