diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2010-12-08 17:41:29 +0000 |
---|---|---|
committer | Adam Kocoloski <kocolosk@apache.org> | 2010-12-08 17:41:29 +0000 |
commit | fcc00849b1a223f5550b9d044461ca8bef45f864 (patch) | |
tree | c50f0a9cf15b0fbccd01ff5313fcc6e7fb644b7e /src/couchdb | |
parent | 9dfee1dbbd7f6cbb255094db860f836c79ace274 (diff) |
Fix compactor crash when .compact file is missing header
Users affected by COUCHDB-968 can take advantage of this patch to
force a compaction in retry mode and thus remove the duplicates.
Simply create an empty dbname.couch.compact file in the database_dir
before triggering the compaction for dbname.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1043542 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r-- | src/couchdb/couch_db_updater.erl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl index bd404c64..633ae230 100644 --- a/src/couchdb/couch_db_updater.erl +++ b/src/couchdb/couch_db_updater.erl @@ -869,7 +869,12 @@ start_copy_compact(#db{name=Name,filepath=Filepath}=Db) -> {ok, Fd} -> couch_task_status:add_task(<<"Database Compaction">>, <<Name/binary, " retry">>, <<"Starting">>), Retry = true, - {ok, Header} = couch_file:read_header(Fd); + case couch_file:read_header(Fd) of + {ok, Header} -> + ok; + no_valid_header -> + ok = couch_file:write_header(Fd, Header=#db_header{}) + end; {error, enoent} -> couch_task_status:add_task(<<"Database Compaction">>, Name, <<"Starting">>), {ok, Fd} = couch_file:open(CompactFile, [create]), |