Skip to content

Commit

Permalink
clusterer: warn if there is no seed node defined in a cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlad-patrascu committed Apr 25, 2018
1 parent 19ee687 commit 5dd381a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions modules/clusterer/node_info.c
Expand Up @@ -283,6 +283,22 @@ int add_node_info(node_info_t **new_info, cluster_info_t **cl_list, int *int_val
} \
} while (0)

static void check_seed_flag(cluster_info_t **cl_list)
{
cluster_info_t *cl;
node_info_t *n;

for (cl = *cl_list; cl; cl = cl->next) {
for (n = cl->node_list; n; n = n->next)
if (n->flags & NODE_IS_SEED)
break;
if (!n && !(cl->current_node->flags & NODE_IS_SEED)) {
LM_NOTICE("No seed node defined in cluster: %d! Some clustering "
"capabilities may not work or have broken behaviour\n", cl->cluster_id);
}
}
}

/* loads info from the db */
int load_db_info(db_func_t *dr_dbf, db_con_t* db_hdl, str *db_table,
cluster_info_t **cl_list)
Expand Down Expand Up @@ -434,6 +450,9 @@ int load_db_info(db_func_t *dr_dbf, db_con_t* db_hdl, str *db_table,
}
}

/* warn if no seed node is defined in a cluster */
check_seed_flag(cl_list);

if (RES_ROW_N(res) == 1)
LM_INFO("The current node is the only one in the cluster\n");

Expand Down

0 comments on commit 5dd381a

Please sign in to comment.