diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-05-01 16:24:38 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-05-01 16:24:38 +0100 |
commit | 63928343ae8317d8692dfd2eb9aa219f4ac5f9b9 (patch) | |
tree | cf8e1016a526a2905101d4235f132f6116c5e8eb | |
parent | cafaa1943a0e20b010449a1908c459f76b848107 (diff) | |
download | rabbitmq-server-63928343ae8317d8692dfd2eb9aa219f4ac5f9b9.tar.gz |
A bit more debugging information on why we might get an error back from the delegate.
-rw-r--r-- | src/mirrored_supervisor.erl | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mirrored_supervisor.erl b/src/mirrored_supervisor.erl index c5f22c51..c5c2c64d 100644 --- a/src/mirrored_supervisor.erl +++ b/src/mirrored_supervisor.erl @@ -308,7 +308,7 @@ handle_call({init, Overall}, _From, State1 = State#state{overall = Overall, delegate = Delegate}, case errors([maybe_start(Group, Delegate, S) || S <- ChildSpecs]) of [] -> {reply, ok, State1}; - Errors -> {stop, {shutdown, Errors}, State1} + Errors -> {stop, {shutdown, {init, Errors, ChildSpecs}}, State1} end; handle_call({start_child, ChildSpec}, _From, @@ -366,15 +366,17 @@ handle_info({'DOWN', _Ref, process, Pid, _Reason}, %% TODO load balance this %% No guarantee pg2 will have received the DOWN before us. Self = self(), - R = case lists:sort(?PG2:get_members(Group)) -- [Pid] of - [Self | _] -> {atomic, ChildSpecs} = + {R, Cs, X} = + case lists:sort(?PG2:get_members(Group)) -- [Pid] of + [Self | _] -> {atomic, {ChildSpecs, Extra}} = mnesia:transaction(fun() -> update_all(Pid) end), - [start(Delegate, ChildSpec) || ChildSpec <- ChildSpecs]; - _ -> [] + {[start(Delegate, ChildSpec) || ChildSpec <- ChildSpecs], + ChildSpecs, Extra}; + _ -> {[], [], []} end, case errors(R) of [] -> {noreply, State}; - Errors -> {stop, {shutdown, Errors}, State} + Errors -> {stop, {shutdown, {down, Errors, Cs, X}}, State} end; handle_info(Info, State) -> @@ -458,8 +460,8 @@ update_all(OldPid) -> key = '$1', childspec = '$2', _ = '_'}, - [write(Group, C) || - [{Group, _Id}, C] <- mnesia:select(?TABLE, [{MatchHead, [], ['$$']}])]. + Matches = mnesia:select(?TABLE, [{MatchHead, [], ['$$']}]), + {[write(Group, C) || [{Group, _Id}, C] <- Matches], {OldPid, Matches}}. delete_all(Group) -> MatchHead = #mirrored_sup_childspec{key = {Group, '_'}, |