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

tridge at samba.org tridge at samba.org
Thu May 10 03:16:00 GMT 2007


------------------------------------------------------------
revno: 272
revision-id: tridge at samba.org-20070510031558-ckupssp96wzoohkd
parent: tridge at samba.org-20070510031023-yhipc23awqwfed3s
parent: sahlberg at ronnie-20070510001058-a7ac6eddce1344a8
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Thu 2007-05-10 13:15:58 +1000
message:
  merge from ronnie
modified:
  direct/ctdb_recoverd.c         recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
  include/ctdb_private.h         ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
  tools/ctdb_control.c           ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
    ------------------------------------------------------------
    revno: 197.1.97
    merged: sahlberg at ronnie-20070510001058-a7ac6eddce1344a8
    parent: sahlberg at ronnie-20070510000321-89f72cadfa94fb77
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Thu 2007-05-10 10:10:58 +1000
    message:
      create a correct vnnmap structure to prevent a segv
    ------------------------------------------------------------
    revno: 197.1.96
    merged: sahlberg at ronnie-20070510000321-89f72cadfa94fb77
    parent: sahlberg at ronnie-20070509234814-caea2e55dd3bc4e7
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Thu 2007-05-10 10:03:21 +1000
    message:
      update ctdb_control to create a correct ctdb_vnn_map->map array
    ------------------------------------------------------------
    revno: 197.1.95
    merged: sahlberg at ronnie-20070509234814-caea2e55dd3bc4e7
    parent: sahlberg at ronnie-20070509234610-5cdd047d69014c36
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Thu 2007-05-10 09:48:14 +1000
    message:
      when starting a new election, also force all nodes into recovery mode so 
      there is no internode traffic to interfere with our election
    ------------------------------------------------------------
    revno: 197.1.94
    merged: sahlberg at ronnie-20070509234610-5cdd047d69014c36
    parent: sahlberg at ronnie-20070509234428-38b8689cb7bd25fe
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Thu 2007-05-10 09:46:10 +1000
    message:
      when starting recovery repoint dmaster to an invalid node and not the 
      current vnn
    ------------------------------------------------------------
    revno: 197.1.93
    merged: sahlberg at ronnie-20070509234428-38b8689cb7bd25fe
    parent: sahlberg at ronnie-20070509234301-c9fe15e2fffd523e
    parent: tridge at samba.org-20070509222226-gxev7f84ugyfdkti
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Thu 2007-05-10 09:44:28 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 197.1.92
    merged: sahlberg at ronnie-20070509234301-c9fe15e2fffd523e
    parent: sahlberg at ronnie-20070509205528-ea549e31fa9af90b
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Thu 2007-05-10 09:43:01 +1000
    message:
      actually check the remote nodes and not just the local node
    ------------------------------------------------------------
    revno: 197.1.91
    merged: sahlberg at ronnie-20070509205528-ea549e31fa9af90b
    parent: sahlberg at ronnie-20070509040811-460ac8e7d6691f7f
    parent: tridge at samba.org-20070509015437-c9u6pubosc3jz0um
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Thu 2007-05-10 06:55:28 +1000
    message:
      merge from tridge
=== modified file 'direct/ctdb_recoverd.c'
--- a/direct/ctdb_recoverd.c	2007-05-10 03:10:23 +0000
+++ b/direct/ctdb_recoverd.c	2007-05-10 03:15:58 +0000
@@ -381,7 +381,7 @@
 	/* repoint all local and remote database records to an invalid
 	   node as being dmaster to stop the shortcut from working
 	 */
-	ret = update_dmaster_on_all_databases(ctdb, nodemap, vnn, dbmap, mem_ctx);
+	ret = update_dmaster_on_all_databases(ctdb, nodemap, 0xffffffff, dbmap, mem_ctx);
 	if (ret != 0) {
 		DEBUG(0, (__location__ "Unable to update dmaster on all databases\n"));
 		return -1;
@@ -546,6 +546,13 @@
 static void force_election(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, uint32_t vnn, struct ctdb_node_map *nodemap)
 {
 	int ret;
+
+	/* set all nodes to recovery mode to stop all internode traffic */
+	ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
+	if (ret!=0) {
+		DEBUG(0, (__location__ "Unable to set recovery mode to active on cluster\n"));
+		return;
+	}
 	
 	ret = send_election_request(ctdb, mem_ctx, vnn);
 	if (ret!=0) {
@@ -657,7 +664,7 @@
 			continue;
 		}
 
-		ret = ctdb_ctrl_getrecmaster(ctdb, timeval_current_ofs(1, 0), vnn, &recmaster);
+		ret = ctdb_ctrl_getrecmaster(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, &recmaster);
 		if (ret != 0) {
 			DEBUG(0, (__location__ "Unable to get recmaster from node %u\n", vnn));
 			goto again;
@@ -679,7 +686,7 @@
 			continue;
 		}
 
-		ret = ctdb_ctrl_getrecmode(ctdb, timeval_current_ofs(1, 0), vnn, &recmode);
+		ret = ctdb_ctrl_getrecmode(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, &recmode);
 		if (ret != 0) {
 			DEBUG(0, ("Unable to get recmode from node %u\n", vnn));
 			goto again;

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h	2007-05-09 22:13:19 +0000
+++ b/include/ctdb_private.h	2007-05-10 03:15:58 +0000
@@ -260,18 +260,22 @@
 
 
 #define CTDB_NO_MEMORY(ctdb, p) do { if (!(p)) { \
+          DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
           ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \
 	  return -1; }} while (0)
 
 #define CTDB_NO_MEMORY_VOID(ctdb, p) do { if (!(p)) { \
+          DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
           ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \
 	  }} while (0)
 
 #define CTDB_NO_MEMORY_NULL(ctdb, p) do { if (!(p)) { \
+          DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
           ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \
 	  return NULL; }} while (0)
 
 #define CTDB_NO_MEMORY_FATAL(ctdb, p) do { if (!(p)) { \
+          DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
           ctdb_fatal(ctdb, "Out of memory in " __location__ ); \
 	  }} while (0)
 

=== modified file 'tools/ctdb_control.c'
--- a/tools/ctdb_control.c	2007-05-09 22:49:57 +0000
+++ b/tools/ctdb_control.c	2007-05-10 03:15:58 +0000
@@ -604,13 +604,14 @@
 	generation = strtoul(argv[1], NULL, 0);
 	num_nodes  = strtoul(argv[2], NULL, 0);
 
-	vnnmap = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*num_nodes);
-	if (vnnmap == NULL) {
-		DEBUG(0,(__location__ " Unable to allocate vnn_map structure\n"));
-		exit(1);
-	}
+	vnnmap = talloc(ctdb, struct ctdb_vnn_map);
+	CTDB_NO_MEMORY(ctdb, vnnmap);
+
 	vnnmap->generation = generation;
 	vnnmap->size       = num_nodes;
+	vnnmap->map        = talloc_array(vnnmap, uint32_t, vnnmap->size);
+	CTDB_NO_MEMORY(ctdb, vnnmap->map);
+
 	for (i=0;i<vnnmap->size;i++) {
 		vnnmap->map[i] = strtoul(argv[3+i], NULL, 0);
 	}



More information about the samba-cvs mailing list