Skip to content

Commit

Permalink
Mirrored supervisor: make it easier to keep track of group membership…
Browse files Browse the repository at this point in the history
… changes

in the logs.

Referenes #3148.
  • Loading branch information
michaelklishin committed Jul 5, 2021
1 parent 973a8c5 commit 65ccf7c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deps/rabbit_common/src/mirrored_supervisor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ handle_call({init, Overall}, _From,
initial_childspecs = ChildSpecs}) ->
process_flag(trap_exit, true),
ok = pg:join(Group, Overall),
rabbit_log:debug("Mirrored supervisor: initializing, joined group ~p", [Group]),
Rest = pg:get_members(Group) -- [Overall],
Nodes = [node(M) || M <- Rest],
rabbit_log:debug("Mirrored supervisor: known group ~p members: ~p on nodes ~p", [Group, Rest, Nodes]),
case Rest of
[] -> TxFun(fun() -> delete_all(Group) end);
_ -> ok
Expand Down Expand Up @@ -420,6 +423,7 @@ delete(Group, Id) ->
ok = mnesia:delete({?TABLE, {Group, Id}}).

start(Delegate, ChildSpec) ->
rabbit_log:debug("Mirrored supervisor: asked to start with delegate: ~p, child spec: ~p", [Delegate, ChildSpec]),
apply(?SUPERVISOR, start_child, [Delegate, ChildSpec]).

stop(Group, TxFun, Delegate, Id) ->
Expand Down

0 comments on commit 65ccf7c

Please sign in to comment.