Merge pull request #4050 from xiang90/fsync

snap: call fsync before close db file
This commit is contained in:
Xiang Li 2015-12-23 09:42:13 -08:00
commit 3f81f020c1

View File

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