Skip to content

Commit aa51496

Browse files
committed
DEBUG: add init/1 trace logs to partisan_monitor
1 parent 97ef86b commit aa51496

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/partisan_monitor.erl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -551,25 +551,23 @@ monitor_nodes(Flag, Opts0) when is_boolean(Flag), is_list(Opts0) ->
551551

552552

553553
init([]) ->
554-
%% We trap exists so that we get a call to terminate w/reason shutdown when
555-
%% the supervisor terminates us. This happens when
556-
%% partisan_peer_service:manager() is terminated.
554+
?LOG_WARNING(">>>>> partisan_monitor:init/1 enter"),
557555
erlang:process_flag(trap_exit, true),
556+
?LOG_WARNING(">>>>> partisan_monitor:init/1 trap_exit set"),
558557

559558
%% We subscribe to node status to implement node monitoring.
560-
%% Certain partisan_peer_service_manager implementations might not support
561-
%% the on_up and on_down events which we need for node monitoring, so in
562-
%% those cases this module will not work.
563559
Enabled = subscribe_to_node_status(),
560+
?LOG_WARNING(">>>>> partisan_monitor:init/1 subscribed to node status, enabled=~p", [Enabled]),
564561
_ = persistent_term:put({?MODULE, enabled}, Enabled),
565562

566-
567563
_ = subscribe_to_channel_status(),
564+
?LOG_WARNING(">>>>> partisan_monitor:init/1 subscribed to channel status"),
568565

569566
%% partisan_gen behaviours call monitor/2 and demonitor/1 so being
570567
%% this server one, that would create a deadlock due to a circular call.
571568
%% We use a static dummy ref for those calls to avoid calling ourselves.
572569
_ = persistent_term:put(?DUMMY_MREF_KEY, partisan:make_ref()),
570+
?LOG_WARNING(">>>>> partisan_monitor:init/1 dummy ref set"),
573571

574572
TabOpts = [
575573
named_table,
@@ -588,13 +586,15 @@ init([]) ->
588586
%% Tables for node status monitoring
589587
_ = ets:new(?NODE_MON, [duplicate_bag, {keypos, 1} | TabOpts]),
590588
_ = ets:new(?NODE_TYPE_MON, [set, {keypos, 2} | TabOpts]),
589+
?LOG_WARNING(">>>>> partisan_monitor:init/1 ets tables created"),
591590

592591
State = #state{
593592
enabled = Enabled,
594593
requests = #{},
595594
nodes = sets:new([{version, 2}])
596595
},
597596

597+
?LOG_WARNING(">>>>> partisan_monitor:init/1 returning ok"),
598598
{ok, State}.
599599

600600

0 commit comments

Comments
 (0)