From 5b06e73fb1051e9fe370a76ef4fc87e514a1f9e5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Nov 2006 11:51:33 +1100 Subject: - split up tcp functions into more logical parts - added upcall methods from transport to ctdb layer (This used to be ctdb commit 59f0dab652000f1c755e59567b03cf84dad7e954) --- ctdb/tcp/tcp_init.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 ctdb/tcp/tcp_init.c (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c new file mode 100644 index 0000000000..d3ca1e581d --- /dev/null +++ b/ctdb/tcp/tcp_init.c @@ -0,0 +1,84 @@ +/* + ctdb over TCP + + Copyright (C) Andrew Tridgell 2006 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "includes.h" +#include "lib/events/events.h" +#include "system/network.h" +#include "system/filesys.h" +#include "ctdb_private.h" +#include "ctdb_tcp.h" + +/* + start the protocol going +*/ +int ctdb_tcp_start(struct ctdb_context *ctdb) +{ + struct ctdb_node *node; + + /* listen on our own address */ + if (ctdb_tcp_listen(ctdb) != 0) return -1; + + /* startup connections to the other servers - will happen on + next event loop */ + for (node=ctdb->nodes;node;node=node->next) { + if (ctdb_same_address(&ctdb->address, &node->address)) continue; + event_add_timed(ctdb->ev, node, timeval_zero(), + ctdb_tcp_node_connect, node); + } + + return 0; +} + + +/* + initialise tcp portion of a ctdb node +*/ +int ctdb_tcp_add_node(struct ctdb_node *node) +{ + struct ctdb_tcp_node *tnode; + tnode = talloc_zero(node, struct ctdb_tcp_node); + CTDB_NO_MEMORY(node->ctdb, tnode); + + tnode->fd = -1; + node->private = tnode; + return 0; +} + + +static const struct ctdb_methods ctdb_tcp_methods = { + .start = ctdb_tcp_start, + .add_node = ctdb_tcp_add_node +}; + +/* + initialise tcp portion of ctdb +*/ +int ctdb_tcp_init(struct ctdb_context *ctdb) +{ + struct ctdb_tcp *ctcp; + ctcp = talloc_zero(ctdb, struct ctdb_tcp); + CTDB_NO_MEMORY(ctdb, ctcp); + + ctcp->listen_fd = -1; + ctdb->private = ctcp; + ctdb->methods = &ctdb_tcp_methods; + return 0; +} + -- cgit From 5d0ba69e06d2f37788697c3b7c39287334d2fa22 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Nov 2006 14:15:46 +1100 Subject: - setup a convenience name field for nodes - added basic IO handling for the tcp backend - added a ctdb_node_dead upcall - added packet queueing - adding incoming packet handling (This used to be ctdb commit 415497c952630e746e8cdcf8e1e2a7b2ac3e51fb) --- ctdb/tcp/tcp_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index d3ca1e581d..b98a92818d 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -63,8 +63,9 @@ int ctdb_tcp_add_node(struct ctdb_node *node) static const struct ctdb_methods ctdb_tcp_methods = { - .start = ctdb_tcp_start, - .add_node = ctdb_tcp_add_node + .start = ctdb_tcp_start, + .add_node = ctdb_tcp_add_node, + .queue_pkt = ctdb_tcp_queue_pkt }; /* -- cgit From fdb317facfdb60c87695b557a4680401c210031a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Nov 2006 17:56:10 +1100 Subject: - added simple (fake) vnn system - split up ctdb layer code into 3 modules - added a simple test suite - added packet structures for ctdb_call - switched to an array for ctdb_node to make vnn lookup easy and fast (This used to be ctdb commit 8a17460a816a5970f2df8244a06aec55d814f186) --- ctdb/tcp/tcp_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index b98a92818d..39ecec4dbd 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -30,14 +30,15 @@ */ int ctdb_tcp_start(struct ctdb_context *ctdb) { - struct ctdb_node *node; + int i; /* listen on our own address */ if (ctdb_tcp_listen(ctdb) != 0) return -1; /* startup connections to the other servers - will happen on next event loop */ - for (node=ctdb->nodes;node;node=node->next) { + for (i=0;inum_nodes;i++) { + struct ctdb_node *node = *(ctdb->nodes + i); if (ctdb_same_address(&ctdb->address, &node->address)) continue; event_add_timed(ctdb->ev, node, timeval_zero(), ctdb_tcp_node_connect, node); -- cgit From ec5d2ddd8e860de584fb572bdb46e58422931010 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 1 Dec 2006 15:45:24 +1100 Subject: - added ctdb_set_flags() call - added --self-connect option to ctdb_test, allowing testing when a node connects to itself. not as efficient as local bypass, but very useful for testing purposes (easier to work with 1 task in gdb than 2) - split the ctdb_call() into an async triple, in the style of Samba4 async functions. So we now have ctdb_call_send(), ctdb_call_recv() and ctdb_call(). - added the main ctdb_call protocol logic. No error checking yet, but seems to work for simple cases - ensure we initialise the length argument to getsockopt() (This used to be ctdb commit 95fad717ef5ab93be3603aa11d2878876fe868d3) --- ctdb/tcp/tcp_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 39ecec4dbd..b337867703 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -39,7 +39,8 @@ int ctdb_tcp_start(struct ctdb_context *ctdb) next event loop */ for (i=0;inum_nodes;i++) { struct ctdb_node *node = *(ctdb->nodes + i); - if (ctdb_same_address(&ctdb->address, &node->address)) continue; + if (!(ctdb->flags & CTDB_FLAG_SELF_CONNECT) && + ctdb_same_address(&ctdb->address, &node->address)) continue; event_add_timed(ctdb->ev, node, timeval_zero(), ctdb_tcp_node_connect, node); } -- cgit From 3c097c9a5fef7a6aa231173cf970b8f6bb11cc82 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 19 Dec 2006 12:03:10 +1100 Subject: added handling of partial packet reads added transport level packet allocator, allowing the transport to enforce alignment or special memory rules (This used to be ctdb commit 50304a5c4d8d640732678eeed793857334ca5ec1) --- ctdb/tcp/tcp_init.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index b337867703..fca6506676 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -64,10 +64,24 @@ int ctdb_tcp_add_node(struct ctdb_node *node) } +/* + transport packet allocator - allows transport to control memory for packets +*/ +void *ctdb_tcp_allocate_pkt(struct ctdb_context *ctdb, size_t size) +{ + /* tcp transport needs to round to 8 byte alignment to ensure + that we can use a length header and 64 bit elements in + structures */ + size = (size+7) & ~7; + return talloc_size(ctdb, size); +} + + static const struct ctdb_methods ctdb_tcp_methods = { .start = ctdb_tcp_start, .add_node = ctdb_tcp_add_node, - .queue_pkt = ctdb_tcp_queue_pkt + .queue_pkt = ctdb_tcp_queue_pkt, + .allocate_pkt = ctdb_tcp_allocate_pkt }; /* -- cgit From a3f91ddf57ea1fa4159cdad47a604770670f5a08 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 19 Dec 2006 12:07:07 +1100 Subject: enforce the tcp memory alignment in packet queue (This used to be ctdb commit 222f53a3205509a45fbc3267297521df22a414ec) --- ctdb/tcp/tcp_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index fca6506676..f261d0c7da 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -72,7 +72,7 @@ void *ctdb_tcp_allocate_pkt(struct ctdb_context *ctdb, size_t size) /* tcp transport needs to round to 8 byte alignment to ensure that we can use a length header and 64 bit elements in structures */ - size = (size+7) & ~7; + size = (size+(CTDB_TCP_ALIGNMENT-1)) & ~(CTDB_TCP_ALIGNMENT-1); return talloc_size(ctdb, size); } -- cgit From 16d2ca6fa0c2e431240b2033d0b2c9196e66c200 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 23 Jan 2007 11:38:45 +1100 Subject: merge fixes from samba4 (This used to be ctdb commit fb90a5424348d0b6ed9a1b8da4ceadcc4d1a1cb1) --- ctdb/tcp/tcp_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index f261d0c7da..0058e7ad85 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -19,10 +19,11 @@ */ #include "includes.h" +#include "lib/tdb/include/tdb.h" #include "lib/events/events.h" #include "system/network.h" #include "system/filesys.h" -#include "ctdb_private.h" +#include "../include/ctdb_private.h" #include "ctdb_tcp.h" /* -- cgit From 91c39b485237d093362bcfcabcdd51b32bb6a371 Mon Sep 17 00:00:00 2001 From: Ronnie sahlberg Date: Tue, 10 Apr 2007 12:39:25 +1000 Subject: move the checking of the CONNECT_WAIT flag into the start method for tcp (This used to be ctdb commit 44f3e4456d931af642192e034f84c961ab1fdcf0) --- ctdb/tcp/tcp_init.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 0058e7ad85..0ab12790d4 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -46,6 +46,12 @@ int ctdb_tcp_start(struct ctdb_context *ctdb) ctdb_tcp_node_connect, node); } + if (ctdb->flags&CTDB_FLAG_CONNECT_WAIT) { + /* wait until all nodes are connected (should not be needed + outide of test code) */ + ctdb_connect_wait(ctdb); + } + return 0; } -- cgit From 5861917468b543824e1093ea5d94bc4592368b9c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Apr 2007 19:40:29 +1000 Subject: make some functions static, and remove an unused structure (This used to be ctdb commit 8d09cac96b2c604a68e4903346cc9db3a66d80da) --- ctdb/tcp/tcp_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 0ab12790d4..52a6f2bcc7 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -29,7 +29,7 @@ /* start the protocol going */ -int ctdb_tcp_start(struct ctdb_context *ctdb) +static int ctdb_tcp_start(struct ctdb_context *ctdb) { int i; @@ -59,7 +59,7 @@ int ctdb_tcp_start(struct ctdb_context *ctdb) /* initialise tcp portion of a ctdb node */ -int ctdb_tcp_add_node(struct ctdb_node *node) +static int ctdb_tcp_add_node(struct ctdb_node *node) { struct ctdb_tcp_node *tnode; tnode = talloc_zero(node, struct ctdb_tcp_node); @@ -74,7 +74,7 @@ int ctdb_tcp_add_node(struct ctdb_node *node) /* transport packet allocator - allows transport to control memory for packets */ -void *ctdb_tcp_allocate_pkt(struct ctdb_context *ctdb, size_t size) +static void *ctdb_tcp_allocate_pkt(struct ctdb_context *ctdb, size_t size) { /* tcp transport needs to round to 8 byte alignment to ensure that we can use a length header and 64 bit elements in -- cgit From 902967249cca47c3a187f8e3ca931f0f0b375343 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Apr 2007 20:48:31 +1000 Subject: fix the queueing for partially connected tcp sockets (This used to be ctdb commit 55f1c2442a53a547302669a4fdd0f1c1deeed930) --- ctdb/tcp/tcp_init.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 52a6f2bcc7..d9725a0e62 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -67,6 +67,10 @@ static int ctdb_tcp_add_node(struct ctdb_node *node) tnode->fd = -1; node->private = tnode; + + tnode->queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT, + ctdb_tcp_tnode_cb, node); + return 0; } -- cgit From d8dd8fbe49831435f005ee06861d46b1fb61f103 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 11 Apr 2007 20:12:15 +0200 Subject: Rename "private" to "private_data" (This used to be ctdb commit 78cf4443ac0c66fb750ef6919bcdec189ac219c9) --- ctdb/tcp/tcp_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index d9725a0e62..20b9bc9e33 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -66,7 +66,7 @@ static int ctdb_tcp_add_node(struct ctdb_node *node) CTDB_NO_MEMORY(node->ctdb, tnode); tnode->fd = -1; - node->private = tnode; + node->private_data = tnode; tnode->queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT, ctdb_tcp_tnode_cb, node); @@ -105,7 +105,7 @@ int ctdb_tcp_init(struct ctdb_context *ctdb) CTDB_NO_MEMORY(ctdb, ctcp); ctcp->listen_fd = -1; - ctdb->private = ctcp; + ctdb->private_data = ctcp; ctdb->methods = &ctdb_tcp_methods; return 0; } -- cgit From b79e29c779b4e1dc3247b3bb2c1d298e08bc8cdc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 19 Apr 2007 10:37:44 +1000 Subject: - make he packet allocation routines take a mem_ctx, which allows us to put memory directly in the right context, avoiding quite a few talloc_steal calls, and simplifying the code - make the fetch lock code in the daemon fully async (This used to be ctdb commit d98b4b4fcadad614861c0d44a3854d97b01d0f74) --- ctdb/tcp/tcp_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 20b9bc9e33..7b5a7b1f43 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -78,13 +78,13 @@ static int ctdb_tcp_add_node(struct ctdb_node *node) /* transport packet allocator - allows transport to control memory for packets */ -static void *ctdb_tcp_allocate_pkt(struct ctdb_context *ctdb, size_t size) +static void *ctdb_tcp_allocate_pkt(TALLOC_CTX *mem_ctx, size_t size) { /* tcp transport needs to round to 8 byte alignment to ensure that we can use a length header and 64 bit elements in structures */ size = (size+(CTDB_TCP_ALIGNMENT-1)) & ~(CTDB_TCP_ALIGNMENT-1); - return talloc_size(ctdb, size); + return talloc_size(mem_ctx, size); } -- cgit From 273a3944a84b5b9e0c0929812b21ada717f85fb7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 19 Apr 2007 16:27:56 +1000 Subject: - added a --torture option to all ctdb tools. This sets CTDB_FLAG_TORTURE, which forces some race conditions to be much more likely. For example a 20% chance of not getting the lock on the first try in the daemon - abstraced the ctdb_ltdb_lock_fetch_requeue() code to allow it to work with both inter-node packets and client->daemon packets - fixed a bug left over in ctdb_call from when the client updated the header on a call reply - removed CTDB_FLAG_CONNECT_WAIT flag (not needed any more) (This used to be ctdb commit 7559dcd184666c3853127e3c8f5baef4fea327c4) --- ctdb/tcp/tcp_init.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 7b5a7b1f43..9b54bb75ba 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -46,12 +46,6 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) ctdb_tcp_node_connect, node); } - if (ctdb->flags&CTDB_FLAG_CONNECT_WAIT) { - /* wait until all nodes are connected (should not be needed - outide of test code) */ - ctdb_connect_wait(ctdb); - } - return 0; } -- cgit From 8ed48aac5100933d5f81836b3d33e646af7a3819 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 30 May 2007 13:26:50 +1000 Subject: don't start the transport connecting to the other nodes until after the startup event script has run (This used to be ctdb commit afca3cc74211aa2e18b1f74d36b2add8dffcfdc7) --- ctdb/tcp/tcp_init.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 35b43bd5e2..665336e947 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -46,9 +46,9 @@ static int ctdb_tcp_add_node(struct ctdb_node *node) } /* - start the protocol going + initialise transport structures */ -static int ctdb_tcp_start(struct ctdb_context *ctdb) +static int ctdb_tcp_initialise(struct ctdb_context *ctdb) { int i; @@ -59,6 +59,16 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) } } + return 0; +} + +/* + start the protocol going +*/ +static int ctdb_tcp_start(struct ctdb_context *ctdb) +{ + int i; + /* listen on our own address */ if (ctdb_tcp_listen(ctdb) != 0) return -1; @@ -90,6 +100,7 @@ static void *ctdb_tcp_allocate_pkt(TALLOC_CTX *mem_ctx, size_t size) static const struct ctdb_methods ctdb_tcp_methods = { + .initialise = ctdb_tcp_initialise, .start = ctdb_tcp_start, .queue_pkt = ctdb_tcp_queue_pkt, .add_node = ctdb_tcp_add_node, -- cgit From c833b06a35afd2de5edc237df0b1a461a649d9e3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 30 May 2007 14:46:14 +1000 Subject: we need to listen at transport initialise stage to find our own node number (This used to be ctdb commit 4a9455dfbe95e53884b46ad26dba0c33e3432ba9) --- ctdb/tcp/tcp_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 665336e947..3ccf580188 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -52,6 +52,9 @@ static int ctdb_tcp_initialise(struct ctdb_context *ctdb) { int i; + /* listen on our own address */ + if (ctdb_tcp_listen(ctdb) != 0) return -1; + for (i=0; inum_nodes; i++) { if (ctdb_tcp_add_node(ctdb->nodes[i]) != 0) { DEBUG(0, ("methods->add_node failed at %d\n", i)); @@ -69,9 +72,6 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) { int i; - /* listen on our own address */ - if (ctdb_tcp_listen(ctdb) != 0) return -1; - /* startup connections to the other servers - will happen on next event loop */ for (i=0;inum_nodes;i++) { -- cgit From bf3b740a1b52e84ce98d4c48a67e95fb5f4643a1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 31 May 2007 13:50:53 +1000 Subject: ctdb is GPL not LGPL (This used to be ctdb commit 8624378010d1c2a1438e1e701339dfba7276f960) --- ctdb/tcp/tcp_init.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 3ccf580188..4f3c29a010 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -3,19 +3,19 @@ Copyright (C) Andrew Tridgell 2006 - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -- cgit From 5e5701a7b802a82ac03df50e34b0f314eca410b0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 2 Jun 2007 08:41:19 +1000 Subject: - make calling of recovered event script async - shutdown sockets before calling shutdown script (This used to be ctdb commit c5e099feef94a014a77742b6cc1d0afe78ef9da9) --- ctdb/tcp/tcp_init.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 4f3c29a010..7e75195302 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -32,14 +32,16 @@ */ static int ctdb_tcp_add_node(struct ctdb_node *node) { + struct ctdb_tcp *ctcp = talloc_get_type(node->ctdb->private_data, + struct ctdb_tcp); struct ctdb_tcp_node *tnode; - tnode = talloc_zero(node, struct ctdb_tcp_node); + tnode = talloc_zero(ctcp, struct ctdb_tcp_node); CTDB_NO_MEMORY(node->ctdb, tnode); tnode->fd = -1; node->private_data = tnode; - tnode->queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT, + tnode->queue = ctdb_queue_setup(node->ctdb, ctcp, tnode->fd, CTDB_TCP_ALIGNMENT, ctdb_tcp_tnode_cb, node); return 0; @@ -76,9 +78,11 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) next event loop */ for (i=0;inum_nodes;i++) { struct ctdb_node *node = *(ctdb->nodes + i); + struct ctdb_tcp_node *tnode = talloc_get_type( + node->private_data, struct ctdb_tcp_node); if (!(ctdb->flags & CTDB_FLAG_SELF_CONNECT) && ctdb_same_address(&ctdb->address, &node->address)) continue; - event_add_timed(ctdb->ev, node, timeval_zero(), + event_add_timed(ctdb->ev, tnode, timeval_zero(), ctdb_tcp_node_connect, node); } @@ -86,6 +90,18 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) } +/* + shutdown the transport +*/ +static void ctdb_tcp_shutdown(struct ctdb_context *ctdb) +{ + struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data, + struct ctdb_tcp); + talloc_free(ctcp); + ctdb->private_data = NULL; +} + + /* transport packet allocator - allows transport to control memory for packets */ @@ -104,7 +120,8 @@ static const struct ctdb_methods ctdb_tcp_methods = { .start = ctdb_tcp_start, .queue_pkt = ctdb_tcp_queue_pkt, .add_node = ctdb_tcp_add_node, - .allocate_pkt = ctdb_tcp_allocate_pkt + .allocate_pkt = ctdb_tcp_allocate_pkt, + .shutdown = ctdb_tcp_shutdown, }; /* -- cgit From be3a00bd7305065bccfc014abd34a4e47fea3e27 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 5 Jun 2007 17:57:07 +1000 Subject: clean out some more cruft (This used to be ctdb commit ad16c5fe2748b48a6f6c79976359d56d9bed33f4) --- ctdb/tcp/tcp_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 7e75195302..ab1de71ca4 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -80,10 +80,10 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) struct ctdb_node *node = *(ctdb->nodes + i); struct ctdb_tcp_node *tnode = talloc_get_type( node->private_data, struct ctdb_tcp_node); - if (!(ctdb->flags & CTDB_FLAG_SELF_CONNECT) && - ctdb_same_address(&ctdb->address, &node->address)) continue; - event_add_timed(ctdb->ev, tnode, timeval_zero(), - ctdb_tcp_node_connect, node); + if (!ctdb_same_address(&ctdb->address, &node->address)) { + event_add_timed(ctdb->ev, tnode, timeval_zero(), + ctdb_tcp_node_connect, node); + } } return 0; -- cgit From 027d40a5eeb77a7a40fd45d8e21d8a8db8a5b72b Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 2 Jul 2007 14:26:50 +1000 Subject: rename tnode->queue to tnode->out_queue to indicate this queue is for sending data out to the other node (This used to be ctdb commit 0bc949c529094570da56c9007ff96b1f5ad02c59) --- ctdb/tcp/tcp_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index ab1de71ca4..603812632d 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -41,7 +41,7 @@ static int ctdb_tcp_add_node(struct ctdb_node *node) tnode->fd = -1; node->private_data = tnode; - tnode->queue = ctdb_queue_setup(node->ctdb, ctcp, tnode->fd, CTDB_TCP_ALIGNMENT, + tnode->out_queue = ctdb_queue_setup(node->ctdb, ctcp, tnode->fd, CTDB_TCP_ALIGNMENT, ctdb_tcp_tnode_cb, node); return 0; -- cgit From 32de198fd3d59033418ac0e05baaf16b17f5ce46 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 15:29:31 +1000 Subject: update lib/replace from samba4 (This used to be ctdb commit f0555484105668c01c21f56322992e752e831109) --- ctdb/tcp/tcp_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 603812632d..f5d4e4c1d6 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program; if not, see . */ #include "includes.h" -- cgit From d1ba047b7f8748ffa22bdbea29e4515e8be97d8b Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Fri, 19 Oct 2007 08:58:30 +1000 Subject: add a new transport method so that when a node is marked as dead, we shut down and restart the transport othervise, if we use the tcp transport the tcp connection might try to retransmit the queued data during the time the node is unavailable. this together with the exponential backoff for tcp means that the tcp connection quickly reaches the maximum backoff rto which is often 60 or 120 seconds. this would mean that it could take up to 60/120 seconds before the tcp layer detects that the connection is dead and it has to be reestablished. (This used to be ctdb commit 0256db470879ce556b0f00070f7ebeaf37e529ab) --- ctdb/tcp/tcp_init.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index f5d4e4c1d6..98a4c493f2 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -88,6 +88,28 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) return 0; } +/* + shutdown and try to restart a connection to a node after it has been + disconnected +*/ +static void ctdb_tcp_restart(struct ctdb_node *node) +{ + struct ctdb_tcp_node *tnode = talloc_get_type( + node->private_data, struct ctdb_tcp_node); + + DEBUG(0,("Tearing down connection to dead node :%d\n", node->pnn)); + + if (tnode->fd == -1) { + close(tnode->fd); + tnode->fd = -1; + } + + ctdb_queue_set_fd(tnode->out_queue, -1); + + event_add_timed(node->ctdb->ev, tnode, timeval_zero(), + ctdb_tcp_node_connect, node); +} + /* shutdown the transport @@ -121,6 +143,7 @@ static const struct ctdb_methods ctdb_tcp_methods = { .add_node = ctdb_tcp_add_node, .allocate_pkt = ctdb_tcp_allocate_pkt, .shutdown = ctdb_tcp_shutdown, + .restart = ctdb_tcp_restart, }; /* -- cgit From 8e22bca5cab9a5d28e45c11de8844c6c7a24d5e3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 22 Oct 2007 16:41:11 +1000 Subject: fixed a double close of a socket, leading to an EPOLL error (This used to be ctdb commit bbe8ad842bdfedd37ef14a6be07ad939113fe9b1) --- ctdb/tcp/tcp_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 1b186c3f40..a47a18d298 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -80,8 +80,9 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) struct ctdb_tcp_node *tnode = talloc_get_type( node->private_data, struct ctdb_tcp_node); if (!ctdb_same_address(&ctdb->address, &node->address)) { - event_add_timed(ctdb->ev, tnode, timeval_zero(), - ctdb_tcp_node_connect, node); + tnode->connect_te = event_add_timed(ctdb->ev, tnode, + timeval_zero(), + ctdb_tcp_node_connect, node); } } @@ -99,11 +100,10 @@ static void ctdb_tcp_restart(struct ctdb_node *node) DEBUG(0,("Tearing down connection to dead node :%d\n", node->pnn)); - tnode->fd = -1; - ctdb_queue_set_fd(tnode->out_queue, -1); + ctdb_tcp_stop_connection(node); - event_add_timed(node->ctdb->ev, tnode, timeval_zero(), - ctdb_tcp_node_connect, node); + tnode->connect_te = event_add_timed(node->ctdb->ev, tnode, timeval_zero(), + ctdb_tcp_node_connect, node); } -- cgit From f6e53f433bf8e184ffc281f14c4eacda1ffc935c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 4 Feb 2008 20:07:15 +1100 Subject: merge from ronnie (This used to be ctdb commit e7b57d38cf7255be823a223cf15b7526285b4f1c) --- ctdb/tcp/tcp_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index a47a18d298..624f6507ef 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -58,7 +58,7 @@ static int ctdb_tcp_initialise(struct ctdb_context *ctdb) for (i=0; inum_nodes; i++) { if (ctdb_tcp_add_node(ctdb->nodes[i]) != 0) { - DEBUG(0, ("methods->add_node failed at %d\n", i)); + DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i)); return -1; } } @@ -98,7 +98,7 @@ static void ctdb_tcp_restart(struct ctdb_node *node) struct ctdb_tcp_node *tnode = talloc_get_type( node->private_data, struct ctdb_tcp_node); - DEBUG(0,("Tearing down connection to dead node :%d\n", node->pnn)); + DEBUG(DEBUG_NOTICE,("Tearing down connection to dead node :%d\n", node->pnn)); ctdb_tcp_stop_connection(node); -- cgit From 9f99b44fd1b68f7bcb0305d49f6f648813451ef6 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 19 Feb 2008 14:44:48 +1100 Subject: to make it easier/less disruptive to add nodes to a running cluster add a new control that causes the node to drop the current nodes list and reread it from the nodes file. During this operation, the node will also drop the tcp layer and restart it. When we drop the tcp layer, by talloc_free()ing the ctcp structure add a destructor to ctcp so that we also can clean up and remove the references in the ctdb structure to the transport layer add two new commands for the ctdb tool. one to list all nodes in the nodesfile and the second a command to trigger a node to drop the transport and reinitialize it with the nde nodes file (This used to be ctdb commit 4bc20ac73e9fa94ffd43cccb6eeb438eeff9963c) --- ctdb/tcp/tcp_init.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 624f6507ef..527373cb08 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -54,7 +54,10 @@ static int ctdb_tcp_initialise(struct ctdb_context *ctdb) int i; /* listen on our own address */ - if (ctdb_tcp_listen(ctdb) != 0) return -1; + if (ctdb_tcp_listen(ctdb) != 0) { + DEBUG(DEBUG_CRIT, (__location__ " Failed to start listening on the CTDB socket\n")); + exit(1); + } for (i=0; inum_nodes; i++) { if (ctdb_tcp_add_node(ctdb->nodes[i]) != 0) { @@ -142,6 +145,18 @@ static const struct ctdb_methods ctdb_tcp_methods = { .restart = ctdb_tcp_restart, }; +static int tcp_ctcp_destructor(struct ctdb_tcp *ctcp) +{ + if (ctcp->listen_fd) { + close(ctcp->listen_fd); + } + ctcp->ctdb->private_data = NULL; + ctcp->ctdb->methods = NULL; + + return 0; +} + + /* initialise tcp portion of ctdb */ @@ -152,8 +167,11 @@ int ctdb_tcp_init(struct ctdb_context *ctdb) CTDB_NO_MEMORY(ctdb, ctcp); ctcp->listen_fd = -1; + ctcp->ctdb = ctdb; ctdb->private_data = ctcp; ctdb->methods = &ctdb_tcp_methods; + + talloc_set_destructor(ctcp, tcp_ctcp_destructor); return 0; } -- cgit From fb5cc542069ac3166fbcb5e978a6c049f34ef07a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 8 May 2008 17:14:00 +1000 Subject: listen_fd is auto-closed Closing it here just causes an epoll error, and may close a fd in use by another structure to be closed. This caused a infinite recovery loop (This used to be ctdb commit bc251ac7029c2689776a8c31b28ac1d233d52d4f) --- ctdb/tcp/tcp_init.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 527373cb08..5c53caf6cd 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -147,9 +147,6 @@ static const struct ctdb_methods ctdb_tcp_methods = { static int tcp_ctcp_destructor(struct ctdb_tcp *ctcp) { - if (ctcp->listen_fd) { - close(ctcp->listen_fd); - } ctcp->ctdb->private_data = NULL; ctcp->ctdb->methods = NULL; -- cgit From 1778280d50ea468b07148798e8e88db7bd9a076e Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 7 Oct 2008 18:12:54 +1100 Subject: When we reload the nodes file instead of shutting down/restarting the entire tcp layer just bounce all outgoing connections and reconnect (This used to be ctdb commit e701a531868149f16561011e65794a4a46ee6596) --- ctdb/tcp/tcp_init.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 5c53caf6cd..8b33efeb06 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -31,16 +31,14 @@ */ static int ctdb_tcp_add_node(struct ctdb_node *node) { - struct ctdb_tcp *ctcp = talloc_get_type(node->ctdb->private_data, - struct ctdb_tcp); struct ctdb_tcp_node *tnode; - tnode = talloc_zero(ctcp, struct ctdb_tcp_node); + tnode = talloc_zero(node, struct ctdb_tcp_node); CTDB_NO_MEMORY(node->ctdb, tnode); tnode->fd = -1; node->private_data = tnode; - tnode->out_queue = ctdb_queue_setup(node->ctdb, ctcp, tnode->fd, CTDB_TCP_ALIGNMENT, + tnode->out_queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT, ctdb_tcp_tnode_cb, node); return 0; -- cgit From edb7241c05c2d11b73d5db0b13460dc363e90919 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 2 Dec 2008 13:26:30 +1100 Subject: redesign how reloadnodes is implemented. modify the transport methods to allow to restart individual connections and set up destructors properly. only tear down/set-up tcp connections to nodes removed from the cluster or nodes added to the cluster. Leave tcp connections to unchanged nodes connected. make "ctdb reloadnodes" explicitely cause a recovery of the cluster once the files have been realoaded (This used to be ctdb commit d1057ed6de7de9f2a64d8fa012c52647e89b515b) --- ctdb/tcp/tcp_init.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 8b33efeb06..737bd8e4a5 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -25,6 +25,17 @@ #include "../include/ctdb_private.h" #include "ctdb_tcp.h" +static int tnode_destructor(struct ctdb_tcp_node *tnode) +{ + struct ctdb_node *node = talloc_find_parent_bytype(tnode, struct ctdb_node); + + if (tnode->fd != -1) { + close(tnode->fd); + tnode->fd = -1; + } + + return 0; +} /* initialise tcp portion of a ctdb node @@ -37,6 +48,7 @@ static int ctdb_tcp_add_node(struct ctdb_node *node) tnode->fd = -1; node->private_data = tnode; + talloc_set_destructor(tnode, tnode_destructor); tnode->out_queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT, ctdb_tcp_tnode_cb, node); @@ -70,21 +82,18 @@ static int ctdb_tcp_initialise(struct ctdb_context *ctdb) /* start the protocol going */ -static int ctdb_tcp_start(struct ctdb_context *ctdb) +static int ctdb_tcp_connect_node(struct ctdb_node *node) { - int i; + struct ctdb_context *ctdb = node->ctdb; + struct ctdb_tcp_node *tnode = talloc_get_type( + node->private_data, struct ctdb_tcp_node); - /* startup connections to the other servers - will happen on + /* startup connection to the other server - will happen on next event loop */ - for (i=0;inum_nodes;i++) { - struct ctdb_node *node = *(ctdb->nodes + i); - struct ctdb_tcp_node *tnode = talloc_get_type( - node->private_data, struct ctdb_tcp_node); - if (!ctdb_same_address(&ctdb->address, &node->address)) { - tnode->connect_te = event_add_timed(ctdb->ev, tnode, - timeval_zero(), - ctdb_tcp_node_connect, node); - } + if (!ctdb_same_address(&ctdb->address, &node->address)) { + tnode->connect_te = event_add_timed(ctdb->ev, tnode, + timeval_zero(), + ctdb_tcp_node_connect, node); } return 0; @@ -119,6 +128,20 @@ static void ctdb_tcp_shutdown(struct ctdb_context *ctdb) ctdb->private_data = NULL; } +/* + start the transport +*/ +static int ctdb_tcp_start(struct ctdb_context *ctdb) +{ + int i; + + for (i=0; inum_nodes; i++) { + ctdb_tcp_connect_node(ctdb->nodes[i]); + } + + return 0; +} + /* transport packet allocator - allows transport to control memory for packets @@ -138,6 +161,7 @@ static const struct ctdb_methods ctdb_tcp_methods = { .start = ctdb_tcp_start, .queue_pkt = ctdb_tcp_queue_pkt, .add_node = ctdb_tcp_add_node, + .connect_node = ctdb_tcp_connect_node, .allocate_pkt = ctdb_tcp_allocate_pkt, .shutdown = ctdb_tcp_shutdown, .restart = ctdb_tcp_restart, -- cgit From 7265c713db1470a3953678f3898ce4fdee219c20 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 24 Mar 2009 13:45:11 +1100 Subject: we need to set the port properly in the parse_ip helper (This used to be ctdb commit 43fe18d86995744ba61c7a6405b70edcb265930a) --- ctdb/tcp/tcp_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 737bd8e4a5..c0606f0ec5 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -27,7 +27,7 @@ static int tnode_destructor(struct ctdb_tcp_node *tnode) { - struct ctdb_node *node = talloc_find_parent_bytype(tnode, struct ctdb_node); + // struct ctdb_node *node = talloc_find_parent_bytype(tnode, struct ctdb_node); if (tnode->fd != -1) { close(tnode->fd); -- cgit From e6170b53894ce188a574c9359e2b8b2797e4e2d1 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 1 Jun 2009 14:18:34 +1000 Subject: add a new node state : DELETED. This is used to mark nodes as being DELETED internally in ctdb so that nodes are not renumbered if / when they are removed from the nodes file. This is used to be able to do "ctdb reloadnodes" at runtime without causing nodes to be renumbered. To do this, instead of deleting a node from the nodes file, just comment it out like 1.0.0.1 #1.0.0.2 1.0.0.3 After removing 1.0.0.2 from the cluster, the remaining nodes retain their pnn's from prior to the deletion, namely 0 and 2 Any line in the nodes file that is commented out represents a DELETED pnn (This used to be ctdb commit 6a5e4fd7fa391206b463bb4e976502f3ac5bd343) --- ctdb/tcp/tcp_init.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index c0606f0ec5..58ed6c8a28 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -69,7 +69,10 @@ static int ctdb_tcp_initialise(struct ctdb_context *ctdb) exit(1); } - for (i=0; inum_nodes; i++) { + for (i=0; i < ctdb->num_nodes; i++) { + if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) { + continue; + } if (ctdb_tcp_add_node(ctdb->nodes[i]) != 0) { DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i)); return -1; @@ -135,7 +138,10 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) { int i; - for (i=0; inum_nodes; i++) { + for (i=0; i < ctdb->num_nodes; i++) { + if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) { + continue; + } ctdb_tcp_connect_node(ctdb->nodes[i]); } -- cgit From 7061ceffd80a7c49bca830e1898fd60088c32a1e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 1 Jul 2010 23:08:49 +1000 Subject: Report client for queue errors. We've been seeing "Invalid packet of length 0" errors, but we don't know what is sending them. Add a name for each queue, and print nread. Signed-off-by: Rusty Russell (This used to be ctdb commit e6cf0e8f14f4263fbd8b995418909199924827e9) --- ctdb/tcp/tcp_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 58ed6c8a28..edc10f8ac9 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -51,7 +51,7 @@ static int ctdb_tcp_add_node(struct ctdb_node *node) talloc_set_destructor(tnode, tnode_destructor); tnode->out_queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT, - ctdb_tcp_tnode_cb, node); + ctdb_tcp_tnode_cb, node, "to-node-%s", node->name); return 0; } -- cgit From f93440c4b7febb67e23580a6217ada832fa6318a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 18 Aug 2010 09:16:31 +0930 Subject: event: Update events to latest Samba version 0.9.8 In Samba this is now called "tevent", and while we use the backwards compatibility wrappers they don't offer EVENT_FD_AUTOCLOSE: that is now a separate tevent_fd_set_auto_close() function. This is based on Samba version 7f29f817fa939ef1bbb740584f09e76e2ecd5b06. Signed-off-by: Rusty Russell (This used to be ctdb commit 85e5e760cc91eb3157d3a88996ce474491646726) --- ctdb/tcp/tcp_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index edc10f8ac9..95141d5610 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -19,7 +19,7 @@ #include "includes.h" #include "lib/tdb/include/tdb.h" -#include "lib/events/events.h" +#include "lib/tevent/tevent.h" #include "system/network.h" #include "system/filesys.h" #include "../include/ctdb_private.h" -- cgit From 43925915550ec8d7f3365fc5f749ea4687183b20 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 13 Apr 2012 16:47:28 +1000 Subject: Remove explicit include of lib/tevent/tevent.h. Signed-off-by: Amitay Isaacs (This used to be ctdb commit 0681014ca5ed2a9b56f63fdace7f894beccf8a9a) --- ctdb/tcp/tcp_init.c | 1 - 1 file changed, 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 95141d5610..3fec599ee5 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -19,7 +19,6 @@ #include "includes.h" #include "lib/tdb/include/tdb.h" -#include "lib/tevent/tevent.h" #include "system/network.h" #include "system/filesys.h" #include "../include/ctdb_private.h" -- cgit From d82b9ae4105581398013975782efe16a874b2eb4 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Thu, 6 Jun 2013 21:58:02 +0200 Subject: build: Fix tdb.h path to enable building with system TDB library (This used to be ctdb commit f8bf99de3a5f56be67aaa67ed836458b1cf73e86) --- ctdb/tcp/tcp_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ctdb/tcp/tcp_init.c') diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index 3fec599ee5..a65e7320f5 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -18,7 +18,7 @@ */ #include "includes.h" -#include "lib/tdb/include/tdb.h" +#include "tdb.h" #include "system/network.h" #include "system/filesys.h" #include "../include/ctdb_private.h" -- cgit