couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject git commit: Fix database compaction retry after server restart
Date Wed, 16 Nov 2011 15:50:53 GMT
Updated Branches:
  refs/heads/1.2.x 359279084 -> 54b9726ae


Fix database compaction retry after server restart

If we attempt to compact a database which has a .compact file
left from a previous compaction attempt, and the current attempt
is the first one, the server will crash because the task was not
registered before.


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

Branch: refs/heads/1.2.x
Commit: 54b9726ae0d684f2c2c4064fd1569c1f70421a08
Parents: 3592790
Author: Filipe David Borba Manana <fdmanana@apache.org>
Authored: Wed Nov 16 14:11:10 2011 +0000
Committer: Filipe David Borba Manana <fdmanana@apache.org>
Committed: Wed Nov 16 15:46:25 2011 +0000

----------------------------------------------------------------------
 src/couchdb/couch_db_updater.erl  |    2 +-
 src/couchdb/couch_task_status.erl |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/54b9726a/src/couchdb/couch_db_updater.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl
index 87971b3..e50f482 100644
--- a/src/couchdb/couch_db_updater.erl
+++ b/src/couchdb/couch_db_updater.erl
@@ -930,7 +930,7 @@ copy_compact(Db, NewDb0, Retry) ->
         {changes_done, 0},
         {total_changes, TotalChanges}
     ],
-    case Retry of
+    case Retry and couch_task_status:is_task_added() of
     true ->
         couch_task_status:update([
             {retry, true},

http://git-wip-us.apache.org/repos/asf/couchdb/blob/54b9726a/src/couchdb/couch_task_status.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_task_status.erl b/src/couchdb/couch_task_status.erl
index d3d7481..e23b560 100644
--- a/src/couchdb/couch_task_status.erl
+++ b/src/couchdb/couch_task_status.erl
@@ -26,6 +26,7 @@
 
 -export([start_link/0, stop/0]).
 -export([all/0, add_task/1, update/1, get/1, set_update_frequency/1]).
+-export([is_task_added/0]).
 
 -export([init/1, terminate/2, code_change/3]).
 -export([handle_call/3, handle_cast/2, handle_info/2]).
@@ -56,6 +57,10 @@ add_task(Props) ->
     gen_server:call(?MODULE, {add_task, TaskProps}).
 
 
+is_task_added() ->
+    is_list(erlang:get(task_status_props)).
+
+
 set_update_frequency(Msecs) ->
     put(task_status_update, {{0, 0, 0}, Msecs * 1000}).
 


Mime
View raw message