Rev 327: merge from ronnie in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Sat May 19 07:21:59 GMT 2007


------------------------------------------------------------
revno: 327
revision-id: tridge at samba.org-20070519072158-w0efl829gire7qbm
parent: tridge at samba.org-20070519040701-3yay8tnb8wvo2vmr
parent: sahlberg at ronnie-20070519065910-liyyxru2wl1eah69
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Sat 2007-05-19 17:21:58 +1000
message:
  merge from ronnie
modified:
  common/ctdb.c                  ctdb.c-20061127094323-t50f58d65iaao5of-2
  common/ctdb_monitor.c          ctdb_monitor.c-20070518100625-8jf4ft1mjzmb22ck-1
  include/ctdb_private.h         ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
    ------------------------------------------------------------
    revno: 326.1.1
    merged: sahlberg at ronnie-20070519065910-liyyxru2wl1eah69
    parent: tridge at samba.org-20070519040701-3yay8tnb8wvo2vmr
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Sat 2007-05-19 16:59:10 +1000
    message:
      use ctdb_dead_node() instead of reimplementing the same code again
      this leaves only one single function where a node is marked as dead
      instead of two places
=== modified file 'common/ctdb.c'
--- a/common/ctdb.c	2007-05-19 04:04:48 +0000
+++ b/common/ctdb.c	2007-05-19 07:21:58 +0000
@@ -380,11 +380,12 @@
 /*
   called by the transport layer when a node is dead
 */
-static void ctdb_node_dead(struct ctdb_node *node)
+void ctdb_node_dead(struct ctdb_node *node)
 {
 	node->ctdb->num_connected--;
 	node->flags &= ~NODE_FLAGS_CONNECTED;
 	node->rx_cnt = 0;
+	node->dead_count = 0;
 	DEBUG(1,("%s: node %s is dead: %d connected\n", 
 		 node->ctdb->name, node->name, node->ctdb->num_connected));
 	ctdb_daemon_cancel_controls(node->ctdb, node);
@@ -393,9 +394,10 @@
 /*
   called by the transport layer when a node is connected
 */
-static void ctdb_node_connected(struct ctdb_node *node)
+void ctdb_node_connected(struct ctdb_node *node)
 {
 	node->ctdb->num_connected++;
+	node->dead_count = 0;
 	node->flags |= NODE_FLAGS_CONNECTED;
 	DEBUG(1,("%s: connected to %s - %d connected\n", 
 		 node->ctdb->name, node->name, node->ctdb->num_connected));

=== modified file 'common/ctdb_monitor.c'
--- a/common/ctdb_monitor.c	2007-05-19 00:20:19 +0000
+++ b/common/ctdb_monitor.c	2007-05-19 07:21:58 +0000
@@ -43,8 +43,8 @@
 		
 		/* it might have come alive again */
 		if (!(node->flags & NODE_FLAGS_CONNECTED) && node->rx_cnt != 0) {
-			DEBUG(0,("Node %u is alive again - marking as connected\n", node->vnn));
-			node->flags |= NODE_FLAGS_CONNECTED;
+			ctdb_node_connected(node);
+			continue;
 		}
 
 		if (node->rx_cnt == 0) {
@@ -56,9 +56,7 @@
 		node->rx_cnt = 0;
 
 		if (node->dead_count >= CTDB_MONITORING_DEAD_COUNT) {
-			DEBUG(0,("Node %u is dead - marking as not connected\n", node->vnn));
-			node->flags &= ~NODE_FLAGS_CONNECTED;
-			ctdb_daemon_cancel_controls(ctdb, node);
+			ctdb_node_dead(node);
 			/* maybe tell the transport layer to kill the
 			   sockets as well?
 			*/

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h	2007-05-19 03:45:24 +0000
+++ b/include/ctdb_private.h	2007-05-19 07:21:58 +0000
@@ -826,5 +826,7 @@
 
 void ctdb_daemon_cancel_controls(struct ctdb_context *ctdb, struct ctdb_node *node);
 void ctdb_call_resend_all(struct ctdb_context *ctdb);
+void ctdb_node_dead(struct ctdb_node *node);
+void ctdb_node_connected(struct ctdb_node *node);
 
 #endif



More information about the samba-cvs mailing list