couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1175089 - /couchdb/trunk/src/couchdb/couch_db_updater.erl
Date Sat, 24 Sep 2011 00:59:42 GMT
Author: fdmanana
Date: Sat Sep 24 00:59:42 2011
New Revision: 1175089

URL: http://svn.apache.org/viewvc?rev=1175089&view=rev
Log:
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.

Modified:
    couchdb/trunk/src/couchdb/couch_db_updater.erl

Modified: couchdb/trunk/src/couchdb/couch_db_updater.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db_updater.erl?rev=1175089&r1=1175088&r2=1175089&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db_updater.erl (original)
+++ couchdb/trunk/src/couchdb/couch_db_updater.erl Sat Sep 24 00:59:42 2011
@@ -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