summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_view_compactor.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2011-09-23 19:50:51 +0000
committerAdam Kocoloski <kocolosk@apache.org>2011-09-23 19:50:51 +0000
commitbefbdfb11f45bd2a5ccffb6b0d5ac04435ac9e55 (patch)
tree38122bc420095f23fc4fd8b4b466a796ba760761 /src/couchdb/couch_view_compactor.erl
parent8a7696145241c4752379271c8253fa0c15093322 (diff)
Write header before handing over compacted group
Writing the header first ensures that the index will not be reset if the server crashes in between the handoff and the next delayed_commit. See COUCHDB-994 git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1174979 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_view_compactor.erl')
-rw-r--r--src/couchdb/couch_view_compactor.erl3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/couchdb/couch_view_compactor.erl b/src/couchdb/couch_view_compactor.erl
index 43fdbc98..0063ef1d 100644
--- a/src/couchdb/couch_view_compactor.erl
+++ b/src/couchdb/couch_view_compactor.erl
@@ -79,6 +79,9 @@ compact_group(Group, EmptyGroup, DbName) ->
maybe_retry_compact(Db, GroupId, NewGroup).
maybe_retry_compact(#db{name = DbName} = Db, GroupId, NewGroup) ->
+ #group{sig = Sig, fd = NewFd} = NewGroup,
+ Header = {Sig, couch_view_group:get_index_header_data(NewGroup)},
+ ok = couch_file:write_header(NewFd, Header),
Pid = couch_view:get_group_server(DbName, GroupId),
case gen_server:call(Pid, {compact_done, NewGroup}) of
ok ->