You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/11/16 16:50:37 UTC
git commit: Fix database compaction retry after server restart
Updated Branches:
refs/heads/master 5d4b8d876 -> 4aa872359
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/4aa87235
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4aa87235
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4aa87235
Branch: refs/heads/master
Commit: 4aa872359e64a51dabcf5a4d3c49f3d93e6f1def
Parents: 5d4b8d8
Author: Filipe David Borba Manana <fd...@apache.org>
Authored: Wed Nov 16 14:11:10 2011 +0000
Committer: Filipe David Borba Manana <fd...@apache.org>
Committed: Wed Nov 16 14:11:10 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/4aa87235/src/couchdb/couch_db_updater.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl
index 8009f5b..e15a944 100644
--- a/src/couchdb/couch_db_updater.erl
+++ b/src/couchdb/couch_db_updater.erl
@@ -932,7 +932,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/4aa87235/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}).