Skip to content

Commit

Permalink
usrloc: Fix pinging with simple active/backup clusters
Browse files Browse the repository at this point in the history
In these types of setups, partitioning the pings across the cluster is
incorrect, as the active node must send all pings.

This patch adds the "shared_pinging" module parameter in order to fix
the pinging behavior for these scenarios.
  • Loading branch information
liviuchircu committed Jun 20, 2018
1 parent 78902eb commit bafdb8b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/usrloc/dlist.c
Expand Up @@ -522,7 +522,7 @@ get_domain_cdb_ucontacts(udomain_t *d, void *buf, int *len,
{
static const cdb_key_t aorhash_key = {str_init("aorhash"), 0}; /* TODO */
struct list_head *_, *__;
int cur_node_idx, nr_nodes, min, max;
int cur_node_idx = 0, nr_nodes = 1, min, max;
char *cpos;
double unit;
cdb_filter_t *aorh_filter;
Expand All @@ -536,8 +536,9 @@ get_domain_cdb_ucontacts(udomain_t *d, void *buf, int *len,
enum cdb_filter_op rhs_op;
int shortage;

cur_node_idx = clusterer_api.get_my_index(
location_cluster, &contact_repl_cap, &nr_nodes);
if (shared_pinging)
cur_node_idx = clusterer_api.get_my_index(
location_cluster, &contact_repl_cap, &nr_nodes);

unit = MAX_DB_AOR_HASH / (double)(part_max * nr_nodes);
min = (int)(unit * part_max * cur_node_idx + unit * part_idx);
Expand Down Expand Up @@ -646,8 +647,8 @@ get_domain_mem_ucontacts(udomain_t *d,void *buf, int *len, unsigned int flags,
if (zero_end)
*len -= (int)sizeof(c->c.len);

if (cluster_mode == CM_FULL_SHARING
|| cluster_mode == CM_FULL_SHARING_CACHEDB) {
if (shared_pinging && (cluster_mode == CM_FULL_SHARING
|| cluster_mode == CM_FULL_SHARING_CACHEDB)) {
cur_node_idx = clusterer_api.get_my_index(
location_cluster, &contact_repl_cap, &nr_nodes);
}
Expand Down
30 changes: 30 additions & 0 deletions modules/usrloc/doc/usrloc_admin.xml
Expand Up @@ -1308,6 +1308,36 @@ modparam("usrloc", "latency_event_min_us_delta", 300000)
</example>
</section>

<section id="param_shared_pinging" xreflabel="shared_pinging">
<title><varname>shared_pinging</varname> (integer)</title>
<para>
Only relevant in a "full sharing" or "full sharing cachedb"
<xref linkend="param_cluster_mode"/>. If set to non-zero, the overall
pinging workload will be equally spread across cluster nodes with the
help of the clustering layer that keeps track of the current number of
active nodes.
</para>
<para>
Disabling this parameter may be useful in simple active/backup
setups, where only the active node must perform the pinging.
</para>
<para>
<emphasis>
Default value is <quote>1 (enabled)</quote>.
</emphasis>
</para>

<example>
<title>Set <varname>shared_pinging</varname> parameter</title>
<programlisting format="linespecific">
...
# do not partition the pinging workload across cluster nodes
modparam("usrloc", "shared_pinging", 0)
...
</programlisting>
</example>
</section>

</section>

<section id="exported_functions" xreflabel="exported_functions">
Expand Down
2 changes: 2 additions & 0 deletions modules/usrloc/ul_mod.c
Expand Up @@ -146,6 +146,7 @@ char *rr_persist_str;
/*!< SQL write mode */
enum ul_sql_write_mode sql_wmode = SQL_NO_WRITE;
char *sql_wmode_str;
int shared_pinging;

int use_domain = 0; /*!< Whether usrloc should use domain part of aor */
int desc_time_order = 0; /*!< By default do not enable timestamp ordering */
Expand Down Expand Up @@ -214,6 +215,7 @@ static param_export_t params[] = {
{"cluster_mode", STR_PARAM, &cluster_mode_str },
{"restart_persistency",STR_PARAM, &rr_persist_str },
{"sql_write_mode", STR_PARAM, &sql_wmode_str },
{"shared_pinging", INT_PARAM, &shared_pinging },

{"use_domain", INT_PARAM, &use_domain },
{"desc_time_order", INT_PARAM, &desc_time_order },
Expand Down
1 change: 1 addition & 0 deletions modules/usrloc/ul_mod.h
Expand Up @@ -120,6 +120,7 @@ extern int cseq_delay;
extern int ul_hash_size;
extern int latency_event_min_us_delta;
extern int latency_event_min_us;
extern int shared_pinging;

extern db_con_t* ul_dbh; /* Database connection handle */
extern db_func_t ul_dbf;
Expand Down

0 comments on commit bafdb8b

Please sign in to comment.