[SCM] CTDB repository - branch master updated - c5035657606283d2e35bea40992505e84ca8e7be

Ronnie Sahlberg sahlberg at samba.org
Fri Jul 18 02:18:25 GMT 2008


The branch, master has been updated
       via  c5035657606283d2e35bea40992505e84ca8e7be (commit)
       via  60e2cb175c449ae65793a3e1ffb60cf030a3a0d5 (commit)
       via  3d58f9b524a40c7b43a2a855212db090e9becefa (commit)
       via  554dcf16d37c8b9e4704df11d21fb272f30f5cec (commit)
      from  52716d26eb84104d65828bed38e69f214a5fa824 (commit)

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


- Log -----------------------------------------------------------------
commit c5035657606283d2e35bea40992505e84ca8e7be
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Jul 18 12:07:25 2008 +1000

    if a new node enters the cluster, that node will already be frozen at start
    but the rest of the nodes are not frozen.
    
    at this stage an election is called by the new node.
    
    Since in this case the nodes are not froze, we can not modify the recmaster
    of the nodes so it is expected that this control would fail.
    
    Add a boolean to send_election_request() to make it not
    try to set the recmaster locally for the case where we are in an election phase
    while not frozen.

commit 60e2cb175c449ae65793a3e1ffb60cf030a3a0d5
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Jul 18 10:59:34 2008 +1000

    We can not assume that just because we could complete a TCP handshake
    to the remote node  that
    1, we are in fact talking to a CTDB daemon
    2, that IF we are talking to a ctdb daemon, it is operational.
    
    So, we can not blindly mark the node as CONNECTED just because
    we can open a TCP connection.
    
    Instead we rely on "If we did get a KEEPALIVE from the remote node,
    is is connected"

commit 3d58f9b524a40c7b43a2a855212db090e9becefa
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Jul 18 10:41:18 2008 +1000

    lower a debug statement

commit 554dcf16d37c8b9e4704df11d21fb272f30f5cec
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Jul 18 10:38:51 2008 +1000

    lower a debug message

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

Summary of changes:
 server/ctdb_daemon.c   |    2 +-
 server/ctdb_recoverd.c |   35 +++++++++++++++++++++--------------
 tcp/tcp_connect.c      |    3 ---
 3 files changed, 22 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index aeb0cbd..3978e28 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -53,7 +53,7 @@ static void flag_change_handler(struct ctdb_context *ctdb, uint64_t srvid,
 	ctdb->nodes[c->pnn]->flags = 
 		(ctdb->nodes[c->pnn]->flags&NODE_FLAGS_DISCONNECTED) 
 		| (c->new_flags & ~NODE_FLAGS_DISCONNECTED);	
-	DEBUG(DEBUG_INFO,("Node flags for node %u are now 0x%x\n", c->pnn, ctdb->nodes[c->pnn]->flags));
+	DEBUG(DEBUG_DEBUG,("Node flags for node %u are now 0x%x\n", c->pnn, ctdb->nodes[c->pnn]->flags));
 
 	/* make sure we don't hold any IPs when we shouldn't */
 	if (c->pnn == ctdb->pnn &&
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 69d867a..b2533af 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -1654,7 +1654,7 @@ static bool ctdb_election_win(struct ctdb_recoverd *rec, struct election_message
 /*
   send out an election request
  */
-static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn)
+static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn, bool update_recmaster)
 {
 	int ret;
 	TDB_DATA election_data;
@@ -1670,19 +1670,26 @@ static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn)
 	election_data.dptr  = (unsigned char *)&emsg;
 
 
-	/* first we assume we will win the election and set 
-	   recoverymaster to be ourself on the current node
-	 */
-	ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), pnn, pnn);
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request\n"));
-		return -1;
-	}
-
-
 	/* send an election message to all active nodes */
 	ctdb_send_message(ctdb, CTDB_BROADCAST_ALL, srvid, election_data);
 
+
+	/* A new node that is already frozen has entered the cluster.
+	   The existing nodes are not frozen and dont need to be frozen
+	   until the election has ended and we start the actual recovery
+	*/
+	if (update_recmaster == true) {
+		/* first we assume we will win the election and set 
+		   recoverymaster to be ourself on the current node
+		 */
+		ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), pnn, pnn);
+		if (ret != 0) {
+			DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request\n"));
+			return -1;
+		}
+	}
+
+
 	return 0;
 }
 
@@ -1720,7 +1727,7 @@ static void election_send_request(struct event_context *ev, struct timed_event *
 	struct ctdb_recoverd *rec = talloc_get_type(p, struct ctdb_recoverd);
 	int ret;
 
-	ret = send_election_request(rec, ctdb_get_pnn(rec->ctdb));
+	ret = send_election_request(rec, ctdb_get_pnn(rec->ctdb), false);
 	if (ret != 0) {
 		DEBUG(DEBUG_ERR,("Failed to send election request!\n"));
 	}
@@ -1856,7 +1863,7 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn,
 						timeval_current_ofs(ctdb->tunable.election_timeout, 0), 
 						ctdb_election_timeout, rec);
 
-	ret = send_election_request(rec, pnn);
+	ret = send_election_request(rec, pnn, true);
 	if (ret!=0) {
 		DEBUG(DEBUG_ERR, (__location__ " failed to initiate recmaster election"));
 		return;
@@ -2901,7 +2908,7 @@ again:
 	}
 
 
-	DEBUG(DEBUG_INFO, (__location__ " Update flags on all nodes\n"));
+	DEBUG(DEBUG_DEBUG, (__location__ " Update flags on all nodes\n"));
 	/*
 	  update all nodes to have the same flags that we have
 	 */
diff --git a/tcp/tcp_connect.c b/tcp/tcp_connect.c
index f3b4f7d..906a665 100644
--- a/tcp/tcp_connect.c
+++ b/tcp/tcp_connect.c
@@ -100,9 +100,6 @@ static void ctdb_node_connect_write(struct event_context *ev, struct fd_event *f
 
 	/* the queue subsystem now owns this fd */
 	tnode->fd = -1;
-       
-	/* tell the ctdb layer we are connected */
-	node->ctdb->upcalls->node_connected(node);
 }
 
 


-- 
CTDB repository


More information about the samba-cvs mailing list