[SCM] CTDB repository - branch master updated - 1.0.99-30-g20678e1

Ronnie Sahlberg sahlberg at samba.org
Sun Oct 25 21:23:01 MDT 2009


The branch, master has been updated
       via  20678e1506db1f96b58c326ee91339e797c07c22 (commit)
       via  a244b75ee49556b0ff51e254cc812594ee3b23a7 (commit)
       via  8ec633b64a05a2d903c2b9639909f15f6375548f (commit)
       via  440e870d61267054b24404bcb69e599226353949 (commit)
       via  752a9c81de97be509de7e7feddde749cc5ee22a8 (commit)
      from  11193e1e192bee6f579bdf1303153571a82711d7 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 20678e1506db1f96b58c326ee91339e797c07c22
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Oct 6 16:16:13 2009 +0200

    ctdb_diagnostics: don't use hardcoded path to iptables
    
    All event scripts use only the relative path, so we should
    here.
    
    Also PATH includes /sbin and /usr/sbin...
    
    metze

commit a244b75ee49556b0ff51e254cc812594ee3b23a7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Oct 9 15:47:06 2009 +0200

    ctdb_client: fix DEBUG statement in ctdb_ctrl_modflags()
    
    metze

commit 8ec633b64a05a2d903c2b9639909f15f6375548f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Oct 9 15:47:49 2009 +0200

    server: if takeover runs when the recovery master becomes unhealthy
    
    The problem was this:
    
    When the monitor event fails, the node->flags get updated,
    and an update (containing the old and new flags) is sent to
    the recovery master.
    
    If the recovery master sends the update to itself (the same process),
    it was compairing the node->flags variable with the received new flags.
    This check always found both flag values to be equal
    and never sets the rec->need_takeover_run variable to true.
    
    There were two problem, first the push_flags_handler() function
    didn't pass the received old flags.
    
    And the ctdb_control_modflags() function ignored the received old flags.
    
    metze

commit 440e870d61267054b24404bcb69e599226353949
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Oct 9 15:50:59 2009 +0200

    server: print out the full 64-bit srvid on 32-bit hosts
    
    metze

commit 752a9c81de97be509de7e7feddde749cc5ee22a8
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Oct 21 17:06:48 2009 +0200

    tcp: don't log an error when we succefully bind to the desired address
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 client/ctdb_client.c   |    2 +-
 server/ctdb_monitor.c  |    4 +++-
 server/ctdb_recoverd.c |   48 ++++++++++++++++++++++++++++++++++++++++++------
 tcp/tcp_connect.c      |    9 ++++++++-
 tools/ctdb_diagnostics |    4 ++--
 5 files changed, 56 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 0948d41..e8c543f 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -2386,7 +2386,7 @@ int ctdb_ctrl_modflags(struct ctdb_context *ctdb, struct timeval timeout, uint32
 					timeout, false, data,
 					NULL, NULL,
 					NULL) != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " ctdb_control to disable node failed\n"));
+		DEBUG(DEBUG_ERR, (__location__ " Unable to update nodeflags on remote nodes\n"));
 
 		talloc_free(tmp_ctx);
 		return -1;
diff --git a/server/ctdb_monitor.c b/server/ctdb_monitor.c
index 056d831..8997535 100644
--- a/server/ctdb_monitor.c
+++ b/server/ctdb_monitor.c
@@ -342,7 +342,9 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
 
 	node         = ctdb->nodes[c->pnn];
 	old_flags    = node->flags;
-	c->old_flags  = node->flags;
+	if (c->pnn != ctdb->pnn) {
+		c->old_flags  = node->flags;
+	}
 	node->flags   = c->new_flags & ~NODE_FLAGS_DISCONNECTED;
 	node->flags  |= (c->old_flags & NODE_FLAGS_DISCONNECTED);
 
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 432af07..ecdcd99 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -1856,14 +1856,14 @@ static void process_ipreallocate_requests(struct ctdb_context *ctdb, struct ctdb
 
 	for (callers=rec->reallocate_callers; callers; callers=callers->next) {
 		DEBUG(DEBUG_INFO,("Sending ip reallocate reply message to "
-				  "%u:%lu\n", (unsigned)callers->rd->pnn,
-				  (long unsigned)callers->rd->srvid));
+				  "%u:%llu\n", (unsigned)callers->rd->pnn,
+				  (unsigned long long)callers->rd->srvid));
 		ret = ctdb_send_message(ctdb, callers->rd->pnn, callers->rd->srvid, result);
 		if (ret != 0) {
 			DEBUG(DEBUG_ERR,("Failed to send ip reallocate reply "
-					 "message to %u:%lu\n",
+					 "message to %u:%llu\n",
 					 (unsigned)callers->rd->pnn,
-					 (long unsigned)callers->rd->srvid));
+					 (unsigned long long)callers->rd->srvid));
 		}
 	}
 
@@ -2056,11 +2056,47 @@ static void push_flags_handler(struct ctdb_context *ctdb, uint64_t srvid,
 {
 	int ret;
 	struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
+	struct ctdb_node_map *nodemap=NULL;
+	TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+	uint32_t recmaster;
+	uint32_t *nodes;
 
-	ret = ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), c->pnn, c->new_flags, ~c->new_flags);
+	/* find the recovery master */
+	ret = ctdb_ctrl_getrecmaster(ctdb, tmp_ctx, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, &recmaster);
 	if (ret != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " Unable to update nodeflags on remote nodes\n"));
+		DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from local node\n"));
+		talloc_free(tmp_ctx);
+		return;
+	}
+
+	/* read the node flags from the recmaster */
+	ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), recmaster, tmp_ctx, &nodemap);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from node %u\n", c->pnn));
+		talloc_free(tmp_ctx);
+		return;
 	}
+	if (c->pnn >= nodemap->num) {
+		DEBUG(DEBUG_ERR,(__location__ " Nodemap from recmaster does not contain node %d\n", c->pnn));
+		talloc_free(tmp_ctx);
+		return;
+	}
+
+	/* send the flags update to all connected nodes */
+	nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
+
+	if (ctdb_client_async_control(ctdb, CTDB_CONTROL_MODIFY_FLAGS,
+				      nodes, 0, CONTROL_TIMEOUT(),
+				      false, data,
+				      NULL, NULL,
+				      NULL) != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " ctdb_control to modify node flags failed\n"));
+
+		talloc_free(tmp_ctx);
+		return;
+	}
+
+	talloc_free(tmp_ctx);
 }
 
 
diff --git a/tcp/tcp_connect.c b/tcp/tcp_connect.c
index c74487b..e1c927d 100644
--- a/tcp/tcp_connect.c
+++ b/tcp/tcp_connect.c
@@ -353,9 +353,16 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
 	        setsockopt(ctcp->listen_fd,SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(one));
 
 		if (bind(ctcp->listen_fd, (struct sockaddr * )&sock, sock_size) == 0) {
-			DEBUG(DEBUG_ERR,(__location__ " Failed to bind() to socket. %s(%d)\n", strerror(errno), errno));
 			break;
 		}
+
+		if (errno == EADDRNOTAVAIL) {
+			DEBUG(DEBUG_DEBUG,(__location__ " Failed to bind() to socket. %s(%d)\n",
+					strerror(errno), errno));
+		} else {
+			DEBUG(DEBUG_ERR,(__location__ " Failed to bind() to socket. %s(%d)\n",
+					strerror(errno), errno));
+		}
 	}
 	
 	if (i == ctdb->num_nodes) {
diff --git a/tools/ctdb_diagnostics b/tools/ctdb_diagnostics
index 7b48299..2cdf3cc 100755
--- a/tools/ctdb_diagnostics
+++ b/tools/ctdb_diagnostics
@@ -167,8 +167,8 @@ show_all "netstat -s"
 show_all "free"
 show_all "crontab -l"
 show_all "sysctl -a"
-show_all "/sbin/iptables -L -n"
-show_all "/sbin/iptables -L -n -t nat"
+show_all "iptables -L -n"
+show_all "iptables -L -n -t nat"
 show_all "/usr/sbin/rpcinfo -p"
 show_all "/usr/sbin/showmount -a"
 show_all "/usr/sbin/showmount -e"


-- 
CTDB repository


More information about the samba-cvs mailing list