Skip to content

Commit f616bc1

Browse files
Merge pull request #16918 from amazon-mq/feature/mirrored-supervisor-lifecycle-logging
Log mirrored_supervisor roster wipe and successful failover at info
2 parents db82371 + 393ee04 commit f616bc1

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

deps/rabbit/src/mirrored_supervisor.erl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,12 @@ handle_call({init, Overall}, _From,
284284
%% leave any genuinely orphaned records to the reconciliation loop.
285285
case Rest =:= [] andalso rabbit_nodes:list_reachable() =:= [node()] of
286286
true ->
287-
?LOG_DEBUG("Mirrored supervisor: no known peer members in group ~tp and no other reachable cluster members, will delete all child records for it", [Group]),
287+
%% Logged at info because this wipes the entire child-record roster
288+
%% for the group. It is expected on a genuine single-node (re)start,
289+
%% but it is the most destructive operation here, so a wrong wipe
290+
%% (e.g. a node that transiently sees no peers) should leave a trace
291+
%% above debug level.
292+
?LOG_INFO("Mirrored supervisor: this node is the sole reachable member, deleting all child records for group ~tp", [Group]),
288293
delete_all(Group);
289294
false -> ok
290295
end,
@@ -402,6 +407,15 @@ handle_info({'DOWN', _Ref, process, Pid, _Reason},
402407
|| ChildSpec <- restore_child_order(
403408
ChildSpecs, ChildOrder)],
404409
case errors(Results) of
410+
[] when ChildSpecs =/= [] ->
411+
%% Log a successful failover: this is a
412+
%% rare, high-consequence event (a peer
413+
%% died and this node re-homed and started
414+
%% its children). The failure branches are
415+
%% already logged; without this the
416+
%% success case was silent.
417+
?LOG_INFO("Mirrored supervisor: failover in group ~tp re-homed and started ~b child(ren) from dead peer on node ~tp",
418+
[Group, length(ChildSpecs), node(Pid)]);
405419
[] -> ok;
406420
Errors ->
407421
?LOG_WARNING("Mirrored supervisor: failover in group ~tp could not start some children, reconciliation will retry: ~tp",

0 commit comments

Comments
 (0)