[SCM] CTDB repository - branch master updated - ctdb-1.12-56-ga97d417

Michael Adam obnox at samba.org
Sat Nov 26 16:02:59 MST 2011


The branch, master has been updated
       via  a97d417aba85e901540147a4dff4794249442939 (commit)
       via  ef5b47d1183ee99c39ae63045a994d35255ac829 (commit)
      from  a95b524e57b861416f65baef7a0235bf7e394cef (commit)

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


- Log -----------------------------------------------------------------
commit a97d417aba85e901540147a4dff4794249442939
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jun 21 15:49:30 2011 +0200

    recoverd: try to become the recovery master if we have the capability, but the current master doesn't
    
    metze

commit ef5b47d1183ee99c39ae63045a994d35255ac829
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jun 21 15:46:34 2011 +0200

    recoverd: let async_getcap_callback() also update ctdb->capabilities
    
    metze

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

Summary of changes:
 server/ctdb_recoverd.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 7f7c25f..36abfd4 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -219,6 +219,10 @@ static void async_getcap_callback(struct ctdb_context *ctdb, uint32_t node_pnn,
 	if (node_pnn < ctdb->num_nodes) {
 		ctdb->nodes[node_pnn]->capabilities = *((uint32_t *)outdata.dptr);
 	}
+
+	if (node_pnn == ctdb->pnn) {
+		ctdb->capabilities = ctdb->nodes[node_pnn]->capabilities;
+	}
 }
 
 /*
@@ -3006,6 +3010,13 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 	}
 	nodemap = rec->nodemap;
 
+	/* update the capabilities for all nodes */
+	ret = update_capabilities(ctdb, nodemap);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " Unable to update node capabilities.\n"));
+		goto again;
+	}
+
 	/* check which node is the recovery master */
 	ret = ctdb_ctrl_getrecmaster(ctdb, mem_ctx, CONTROL_TIMEOUT(), pnn, &rec->recmaster);
 	if (ret != 0) {
@@ -3028,7 +3039,6 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 		return;
 	}
 
-
 	/* if the local daemon is STOPPED, we verify that the databases are
 	   also frozen and thet the recmode is set to active 
 	*/
@@ -3063,6 +3073,21 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 		return;
 	}
 	
+	/*
+	 * if the current recmaster do not have CTDB_CAP_RECMASTER,
+	 * but we have force an election and try to become the new
+	 * recmaster
+	 */
+	if ((rec->ctdb->nodes[rec->recmaster]->capabilities & CTDB_CAP_RECMASTER) == 0 &&
+	    (rec->ctdb->capabilities & CTDB_CAP_RECMASTER) &&
+	     !(nodemap->nodes[pnn].flags & NODE_FLAGS_INACTIVE)) {
+		DEBUG(DEBUG_ERR, (__location__ " Current recmaster node %u does not have CAP_RECMASTER,"
+				  " but we (node %u) have - force an election\n",
+				  rec->recmaster, pnn));
+		force_election(rec, pnn, nodemap);
+		goto again;
+	}
+
 	/* check that we (recovery daemon) and the local ctdb daemon
 	   agrees on whether we are banned or not
 	*/


-- 
CTDB repository


More information about the samba-cvs mailing list