summaryrefslogtreecommitdiff
path: root/ctdb/tcp
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2009-06-01 14:18:34 +1000
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2009-06-01 14:18:34 +1000
commite6170b53894ce188a574c9359e2b8b2797e4e2d1 (patch)
tree28c61aa02c6d1e5fdbddfdb4774bcd54c3ab5d11 /ctdb/tcp
parent42591560506c7fee977975e261e4790ae1a0f97f (diff)
downloadsamba-e6170b53894ce188a574c9359e2b8b2797e4e2d1.tar.gz
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)
Diffstat (limited to 'ctdb/tcp')
-rw-r--r--ctdb/tcp/tcp_connect.c6
-rw-r--r--ctdb/tcp/tcp_init.c10
2 files changed, 13 insertions, 3 deletions
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index 9d28d48a1f0..fc169e70b70 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -296,7 +296,11 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
return -1;
}
- for (i=0;i<ctdb->num_nodes;i++) {
+ for (i=0; i < ctdb->num_nodes; i++) {
+ if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) {
+ continue;
+ }
+
/* if node_ip is specified we will only try to bind to that
ip.
*/
diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c
index c0606f0ec54..58ed6c8a28b 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; i<ctdb->num_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; i<ctdb->num_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]);
}