diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/couchdb/couch_db_updater.erl | 5 | ||||
-rw-r--r-- | src/couchdb/couch_file.erl | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl index 664b1e97..9a5476e8 100644 --- a/src/couchdb/couch_db_updater.erl +++ b/src/couchdb/couch_db_updater.erl @@ -681,6 +681,7 @@ commit_data(Db, true) -> commit_data(Db, _) -> #db{ fd = Fd, + filepath = Filepath, header = OldHeader, fsync_options = FsyncOptions, waiting_delayed_commit = Timer @@ -691,14 +692,14 @@ commit_data(Db, _) -> Db; Header -> case lists:member(before_header, FsyncOptions) of - true -> ok = couch_file:sync(Fd); + true -> ok = couch_file:sync(Filepath); _ -> ok end, ok = couch_file:write_header(Fd, Header), case lists:member(after_header, FsyncOptions) of - true -> ok = couch_file:sync(Fd); + true -> ok = couch_file:sync(Filepath); _ -> ok end, diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl index 34d0c453..1f1fbe83 100644 --- a/src/couchdb/couch_file.erl +++ b/src/couchdb/couch_file.erl @@ -146,6 +146,9 @@ truncate(Fd, Pos) -> %% or {error, Reason}. %%---------------------------------------------------------------------- +sync(Filepath) when is_list(Filepath) -> + {ok, Fd} = file:open(Filepath, [read, raw]), + try file:sync(Fd) after file:close(Fd) end; sync(Fd) -> gen_server:call(Fd, sync, infinity). |