From: Igor Canadi Date: Tue, 22 Apr 2014 00:47:48 +0000 (-0700) Subject: Flush before Sync() X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ce068c09ddee2d6dbdaebd47c8d38592b717ff65;p=rocksdb.git Flush before Sync() --- diff --git a/util/env_posix.cc b/util/env_posix.cc index bce9526a6..9e76a126d 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -761,6 +761,10 @@ class PosixWritableFile : public WritableFile { } virtual Status Sync() { + Status s = Flush(); + if (!s.ok()) { + return s; + } TEST_KILL_RANDOM(rocksdb_kill_odds); if (pending_sync_ && fdatasync(fd_) < 0) { return IOError(filename_, errno); @@ -771,6 +775,10 @@ class PosixWritableFile : public WritableFile { } virtual Status Fsync() { + Status s = Flush(); + if (!s.ok()) { + return s; + } TEST_KILL_RANDOM(rocksdb_kill_odds); if (pending_fsync_ && fsync(fd_) < 0) { return IOError(filename_, errno);