couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject [38/50] git commit: Fix database compaction crash on retry
Date Wed, 26 Oct 2011 18:05:33 GMT
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


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/4903011a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4903011a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4903011a

Branch: refs/heads/1319-large-headers-are-corrupted
Commit: 4903011a85aabbc99cde227f9300b3dd384718fa
Parents: a89426f
Author: Filipe David Borba Manana <fdmanana@apache.org>
Authored: Sat Sep 24 00:59:42 2011 +0000
Committer: Filipe David Borba Manana <fdmanana@apache.org>
Committed: Sat Sep 24 00:59:42 2011 +0000

----------------------------------------------------------------------
 src/couchdb/couch_db_updater.erl |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/4903011a/src/couchdb/couch_db_updater.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl
index 78d3660..b24fc56 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 ->


Mime
View raw message