diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2011-09-24 00:59:42 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2011-09-24 00:59:42 +0000 |
commit | 4903011a85aabbc99cde227f9300b3dd384718fa (patch) | |
tree | 6407da2551cd485fdaf7e06edf7a3dced6a8bacd | |
parent | a89426f7cf571b7f64d3290c684715bab4408299 (diff) | |
download | couchdb-4903011a85aabbc99cde227f9300b3dd384718fa.tar.gz |
Fix database compaction crash on retry
If the compaction is retried 2 or more times, there's a badmatch
when asserting that the number of changes processed equals the
number of total changes. This is due to the fact that the task
properties were not updated properly once a retry happens.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1175089 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/couchdb/couch_db_updater.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl index 78d36608b..b24fc56cb 100644 --- a/src/couchdb/couch_db_updater.erl +++ b/src/couchdb/couch_db_updater.erl @@ -924,7 +924,12 @@ copy_compact(Db, NewDb0, Retry) -> ], case Retry of true -> - couch_task_status:update([{retry, true}]); + couch_task_status:update([ + {retry, true}, + {progress, 0}, + {changes_done, 0}, + {total_changes, TotalChanges} + ]); false -> couch_task_status:add_task(TaskProps0), couch_task_status:set_update_frequency(500) @@ -936,7 +941,7 @@ copy_compact(Db, NewDb0, Retry) -> [{start_key, NewDb#db.update_seq + 1}]), NewDb3 = copy_docs(Db, NewDb2, lists:reverse(Uncopied), Retry), - TotalChanges = (couch_task_status:get(changes_done) - NewDb#db.update_seq), + TotalChanges = couch_task_status:get(changes_done), % copy misc header values if NewDb3#db.security /= Db#db.security -> |