summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2017-11-20 15:17:15 +1100
committerMartin Schwenke <martins@samba.org>2017-11-30 11:34:20 +0100
commit2b253f6b1bc4e765f3fcb614a3b67b14084a625d (patch)
tree6a30cfb8292b309567bcb049cc0cf699efd7106d /ctdb
parent27bb8814a526adbd22452ce58754d18e1b00d426 (diff)
downloadsamba-2b253f6b1bc4e765f3fcb614a3b67b14084a625d.tar.gz
ctdb-takeover: Refactor code to send tickle lists for all public IPs
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13154 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/ctdb_takeover.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index 5e8aabfe80e..22dd878818d 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -1983,43 +1983,53 @@ static int ctdb_send_set_tcp_tickles_for_ip(struct ctdb_context *ctdb,
return ret;
}
-
-/*
- perform tickle updates if required
- */
-static void ctdb_update_tcp_tickles(struct tevent_context *ev,
- struct tevent_timer *te,
- struct timeval t, void *private_data)
+static void ctdb_send_set_tcp_tickles_for_all(struct ctdb_context *ctdb,
+ bool force)
{
- struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
- int ret;
struct ctdb_vnn *vnn;
+ int ret;
- for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
- /* we only send out updates for public addresses that
+ for (vnn = ctdb->vnn; vnn != NULL; vnn = vnn->next) {
+ /* we only send out updates for public addresses that
we have taken over
*/
if (ctdb->pnn != vnn->pnn) {
continue;
}
+
/* We only send out the updates if we need to */
- if (!vnn->tcp_update_needed) {
+ if (!force && !vnn->tcp_update_needed) {
continue;
}
+
ret = ctdb_send_set_tcp_tickles_for_ip(ctdb,
&vnn->public_address,
vnn->tcp_array);
if (ret != 0) {
- DEBUG(DEBUG_ERR,("Failed to send the tickle update for public address %s\n",
- ctdb_addr_to_str(&vnn->public_address)));
+ D_ERR("Failed to send the tickle update for ip %s\n",
+ ctdb_addr_to_str(&vnn->public_address));
+ vnn->tcp_update_needed = true;
} else {
- DEBUG(DEBUG_INFO,
- ("Sent tickle update for public address %s\n",
- ctdb_addr_to_str(&vnn->public_address)));
+ D_INFO("Sent tickle update for ip %s\n",
+ ctdb_addr_to_str(&vnn->public_address));
vnn->tcp_update_needed = false;
}
}
+}
+
+/*
+ perform tickle updates if required
+ */
+static void ctdb_update_tcp_tickles(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval t, void *private_data)
+{
+ struct ctdb_context *ctdb = talloc_get_type(
+ private_data, struct ctdb_context);
+
+ ctdb_send_set_tcp_tickles_for_all(ctdb, false);
+
tevent_add_timer(ctdb->ev, ctdb->tickle_update_context,
timeval_current_ofs(ctdb->tunable.tickle_update_interval, 0),
ctdb_update_tcp_tickles, ctdb);