From 43d09a56db0660e3c05d946ad4234147aff692d6 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Thu, 28 Sep 2017 11:47:00 +1000 Subject: [PATCH 1/3] ctdb-daemon: Send broadcast to connected nodes, not configured nodes https://bugzilla.samba.org/show_bug.cgi?id=13056 Database recovery takes care of attaching missing databases on all the nodes. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit 70d306373e80eafe3a356c60a823a2577001d7d1) --- ctdb/server/ctdb_ltdb_server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index d83783854a0..c199aac2d1d 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -1206,7 +1206,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, } /* tell all the other nodes about this database */ - ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, 0, opcode, + ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_CONNECTED, 0, opcode, 0, CTDB_CTRL_FLAG_NOREPLY, indata, NULL, NULL); @@ -1260,7 +1260,8 @@ int32_t ctdb_control_db_detach(struct ctdb_context *ctdb, TDB_DATA indata, client = reqid_find(ctdb->idr, client_id, struct ctdb_client); if (client != NULL) { /* forward the control to all the nodes */ - ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, 0, + ctdb_daemon_send_control(ctdb, + CTDB_BROADCAST_CONNECTED, 0, CTDB_CONTROL_DB_DETACH, 0, CTDB_CTRL_FLAG_NOREPLY, indata, NULL, NULL); -- 2.13.6 From aa0e965711651e15ce0cb7f4ff36e7cbdf86fb05 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Thu, 28 Sep 2017 11:47:24 +1000 Subject: [PATCH 2/3] ctdb-tests: Send broadcast to connected nodes, not configured nodes https://bugzilla.samba.org/show_bug.cgi?id=13056 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit bf11bea5dbb589186a205fa1d81368cc89a6139b) --- ctdb/tests/src/cluster_wait.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctdb/tests/src/cluster_wait.c b/ctdb/tests/src/cluster_wait.c index 1405738ac47..ecd2efdf314 100644 --- a/ctdb/tests/src/cluster_wait.c +++ b/ctdb/tests/src/cluster_wait.c @@ -264,7 +264,7 @@ static void cluster_wait_join_unregistered(struct tevent_req *subreq) msg.data.data = tdb_null; subreq = ctdb_client_message_send(state, state->ev, state->client, - CTDB_BROADCAST_ALL, &msg); + CTDB_BROADCAST_CONNECTED, &msg); if (tevent_req_nomem(subreq, req)) { return; } -- 2.13.6 From 7ce07a819c842487062a5fd9eaef1e6222a1e70a Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 29 Sep 2017 14:23:24 +1000 Subject: [PATCH 3/3] ctdb-common: Do not queue a packet if queue does not have valid fd BUG: https://bugzilla.samba.org/show_bug.cgi?id=13056 The only time a ctdb_queue is created without valid fd is when CTDB is trying to establish connections with other nodes in the cluster. All the other uses always create a ctdb_queue with valid fd. This avoids queueing up packets for dead nodes or nodes that are not running in the cluster and stops consuming memory. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit ddd97553f0a8bfaada178ec4a7460d76fa21f079) --- ctdb/common/ctdb_io.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c index 152d535f0e5..3e732e8527d 100644 --- a/ctdb/common/ctdb_io.c +++ b/ctdb/common/ctdb_io.c @@ -300,6 +300,11 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length) struct ctdb_queue_pkt *pkt; uint32_t length2, full_length; + /* If the queue does not have valid fd, no point queueing a packet */ + if (queue->fd == -1) { + return 0; + } + if (queue->alignment) { /* enforce the length and alignment rules from the tcp packet allocator */ length2 = (length+(queue->alignment-1)) & ~(queue->alignment-1); -- 2.13.6