From afaa5d561826ccf7cab4fde2af9ad39d32ea4d0d Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Fri, 4 Apr 2008 03:10:34 +0000 Subject: compaction code, not hooked up to webserver yet git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@644593 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_file.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/couchdb/couch_file.erl') diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl index 6cbad44a..3a1a7af1 100644 --- a/src/couchdb/couch_file.erl +++ b/src/couchdb/couch_file.erl @@ -142,8 +142,7 @@ close(Fd) -> write_header(Fd, Prefix, Data) -> - % The leading bytes in every db file, the sig and the file version: - %the actual header data + ok = sync(Fd), TermBin = term_to_binary(Data), % the size of all the bytes written to the header, including the md5 signature (16 bytes) FilledSize = size(Prefix) + size(TermBin) + 16, @@ -159,7 +158,8 @@ write_header(Fd, Prefix, Data) -> WriteBin = <>, ?HEADER_SIZE = size(WriteBin), % sanity check DblWriteBin = [WriteBin, WriteBin], - ok = pwrite(Fd, 0, DblWriteBin) + ok = pwrite(Fd, 0, DblWriteBin), + ok = sync(Fd) end. -- cgit v1.2.3