Skip to content

Commit

Permalink
clusterer: Add some dev debugging logs
Browse files Browse the repository at this point in the history
(cherry picked from commit 5eae5fb)
  • Loading branch information
liviuchircu committed Dec 4, 2024
1 parent b1038d4 commit 7cd5550
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/clusterer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
include ../../Makefile.defs
auto_gen=
NAME=clusterer.so
#DEFS+= -DCLUSTERER_DBG
#DEFS+= -DCLUSTERER_EXTRA_BIN_DBG

include ../../Makefile.modules
6 changes: 6 additions & 0 deletions modules/clusterer/clusterer.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,10 @@ int run_rcv_mi_cmd(str *cmd_name, str *cmd_params_arr, int no_params);
int ipc_dispatch_mod_packet(bin_packet_t *packet, struct capability_reg *cap,
int cluster_id);

#ifdef CLUSTERER_DBG
#define CL_DBG(fmtargs...) LM_INFO(fmtargs)
#else
#define CL_DBG(fmtargs...)
#endif

#endif /* CLUSTERER_H */
10 changes: 9 additions & 1 deletion modules/clusterer/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,13 @@ void heartbeats_timer(void)
if (node->link_state == LS_RESTART_PINGING) {
prev_ls = node->link_state;
lock_release(node->lock);
CL_DBG("case 0: RESTART_PINGING\n");

/* restart pinging sequence */
do_action_trans_0(node, &new_ls);
} else if (node->link_state == LS_RETRY_SEND_FAIL &&
last_ping_int >= (utime_t)ping_timeout*1000) {
CL_DBG("case 1: RETRY_SEND_FAIL and timeout\n");
prev_ls = node->link_state;
lock_release(node->lock);

Expand All @@ -232,6 +234,7 @@ void heartbeats_timer(void)
} else if ((node->link_state == LS_UP || node->link_state == LS_RESTARTED) &&
(ping_reply_int >= (time_t)ping_timeout*1000) &&
last_ping_int >= (utime_t)ping_timeout*1000) {
CL_DBG("case 2: LS_UP and timeout\n");
prev_ls = -2;
lock_release(node->lock);

Expand All @@ -241,27 +244,32 @@ void heartbeats_timer(void)
} else if (node->link_state == LS_RETRYING &&
(ping_reply_int >= (time_t)ping_timeout*1000) &&
last_ping_int >= (utime_t)ping_timeout*1000) {
CL_DBG("case 3: LS_RETRYING and timeout\n");
prev_ls = node->link_state;
lock_release(node->lock);

/* previous ping retry not replied, continue to retry */
do_action_trans_3(node, &new_ls);
} else if (node->link_state == LS_DOWN &&
last_ping_int >= (utime_t)node_timeout*1000000) {
CL_DBG("case 4: LS_DOWN and timeout\n");
prev_ls = node->link_state;
lock_release(node->lock);

/* ping a failed node after node_timeout since last ping */
do_action_trans_4(node, &new_ls);
} else if (node->link_state == LS_UP &&
last_ping_int >= (utime_t)ping_interval*1000000) {
CL_DBG("case 5: LS_UP and timeout\n");
prev_ls = node->link_state;
lock_release(node->lock);

/* send regular ping */
do_action_trans_5(node, &new_ls, ev_actions_required, no_clusters);
} else
} else {
CL_DBG("case 6: do nothing\n");
lock_release(node->lock);
}

if (new_ls >= 0)
set_link_w_neigh_adv(prev_ls, new_ls, node);
Expand Down

0 comments on commit 7cd5550

Please sign in to comment.