Permalink
Browse files

CBD-130 Don't shutdown on cleanup/compactor error

If the cleanup or compactor processes exit with an
unexpected reason, don't shutdown the view group
process, just log an error message. Restarting the
view group process (after a subsequent request) is a
fairly expensive operation.

Change-Id: I9de136810797b21f38a84277ba527283ab4e72f8
Reviewed-on: http://review.couchbase.org/16022
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  • Loading branch information...
1 parent 6bd9723 commit 34d107e26d462a03ac557626fe0a04d5d783d394 @fdmanana fdmanana committed May 15, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/couch_set_view/src/couch_set_view_group.erl
@@ -777,7 +777,10 @@ handle_info({'EXIT', Pid, {clean_group, NewGroup, Count, Time}}, #state{cleaner_
{noreply, maybe_apply_pending_transition(State2)};
handle_info({'EXIT', Pid, Reason}, #state{cleaner_pid = Pid} = State) ->
- {stop, {cleaner_died, Reason}, State#state{cleaner_pid = nil}};
+ ?LOG_ERROR("Set view `~s`, ~s group `~s`, cleanup process ~p died with "
+ "unexpected reason: ~p",
+ [?set_name(State), ?type(State), ?group_id(State), Pid, Reason]),
+ {noreply, State#state{cleaner_pid = nil}, ?TIMEOUT};
handle_info({'EXIT', Pid, Reason},
#state{group = #set_view_group{db_set = Pid}} = State) ->
@@ -867,8 +870,15 @@ handle_info({'EXIT', Pid, normal}, State) ->
{noreply, State, ?TIMEOUT};
handle_info({'EXIT', Pid, Reason}, #state{compactor_pid = Pid} = State) ->
+ ?LOG_ERROR("Set view `~s`, ~s group `~s`, compactor process ~p died with "
+ "unexpected reason: ~p",
+ [?set_name(State), ?type(State), ?group_id(State), Pid, Reason]),
couch_util:shutdown_sync(State#state.compactor_file),
- {stop, {compactor_died, Reason}, State};
+ State2 = State#state{
+ compactor_pid = nil,
+ compactor_file = nil
+ },
+ {noreply, State2, ?TIMEOUT};
handle_info({'EXIT', Pid, Reason}, #state{group = #set_view_group{db_set = Pid}} = State) ->
{stop, {db_set_died, Reason}, State};

0 comments on commit 34d107e

Please sign in to comment.