summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_file.erl
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2008-04-04 03:10:34 +0000
committerDamien F. Katz <damien@apache.org>2008-04-04 03:10:34 +0000
commitafaa5d561826ccf7cab4fde2af9ad39d32ea4d0d (patch)
treee94b0bca1ee069f95f34c66fbcd21c2a03061ba5 /src/couchdb/couch_file.erl
parent88627dd6d98acd1a6700994037f4da1362dbcb3e (diff)
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
Diffstat (limited to 'src/couchdb/couch_file.erl')
-rw-r--r--src/couchdb/couch_file.erl6
1 files changed, 3 insertions, 3 deletions
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 = <<Prefix/binary, TermBin/binary, PadZeros/binary, Sig/binary>>,
?HEADER_SIZE = size(WriteBin), % sanity check
DblWriteBin = [WriteBin, WriteBin],
- ok = pwrite(Fd, 0, DblWriteBin)
+ ok = pwrite(Fd, 0, DblWriteBin),
+ ok = sync(Fd)
end.