[SCM] CTDB repository - branch master updated - ctdb-1.10-82-g307e5e9

Ronnie Sahlberg sahlberg at samba.org
Mon Feb 7 23:24:31 MST 2011


The branch, master has been updated
       via  307e5e95548155a31682dfcb0956834d0c85838e (commit)
       via  ef1de8211f83259ea37dcd57562139a3b63d9631 (commit)
      from  3e9317a2e1f687b04bf51575d47fcd4faa6e6515 (commit)

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


- Log -----------------------------------------------------------------
commit 307e5e95548155a31682dfcb0956834d0c85838e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Feb 2 15:00:53 2011 +1100

    We default to non-deterministic ip now where ips are "sticky" and dont change
    too much.
    This means we can simplify the way we add ips significantly and stop
    trying to move them.
    
    We also check if the node already hosts the ip, in which case we used to return an error. Instead just print an error string but return 0, ok.
    This makes it easier to script, and works around broken scripts.
    
    CQ1021034

commit ef1de8211f83259ea37dcd57562139a3b63d9631
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Jan 31 17:40:26 2011 +1100

    If the node is stopped,   put a log entry in /var/log/* to indicate this is why we never become ready

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

Summary of changes:
 server/ctdb_monitor.c |    3 +++
 tools/ctdb.c          |   45 ++++++++++++++-------------------------------
 2 files changed, 17 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_monitor.c b/server/ctdb_monitor.c
index 416e4c5..02f7149 100644
--- a/server/ctdb_monitor.c
+++ b/server/ctdb_monitor.c
@@ -222,6 +222,9 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
 	int ret;
 
 	DEBUG(DEBUG_NOTICE,("CTDB_WAIT_UNTIL_RECOVERED\n"));
+	if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_STOPPED) {
+		DEBUG(DEBUG_NOTICE,("Node is STOPPED. Node will NOT recover.\n"));
+	}
 
 	if (ctdb->vnn_map->generation == INVALID_GENERATION) {
 		ctdb->db_persistent_startup_generation = INVALID_GENERATION;
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 8d82d4d..cd40e38 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -1667,7 +1667,6 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
 {
 	int i, ret;
 	int len, retries = 0;
-	uint32_t pnn;
 	unsigned mask;
 	ctdb_sock_addr addr;
 	struct ctdb_control_ip_iface *pub;
@@ -1686,23 +1685,28 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
 		return -1;
 	}
 
-	ret = control_get_all_public_ips(ctdb, tmp_ctx, &ips);
+	/* read the public ip list from the node */
+	ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.pnn, tmp_ctx, &ips);
 	if (ret != 0) {
-		DEBUG(DEBUG_ERR, ("Unable to get public ip list from cluster\n"));
+		DEBUG(DEBUG_ERR, ("Unable to get public ip list from node %u\n", options.pnn));
 		talloc_free(tmp_ctx);
-		return ret;
+		return -1;
 	}
-
-
-	/* check if some other node is already serving this ip, if not,
-	 * we will claim it
-	 */
 	for (i=0;i<ips->num;i++) {
 		if (ctdb_same_ip(&addr, &ips->ips[i].addr)) {
-			break;
+			DEBUG(DEBUG_ERR,("Can not add ip to node. Node already hosts this ip\n"));
+			return 0;
 		}
 	}
 
+
+
+	/* Dont timeout. This command waits for an ip reallocation
+	   which sometimes can take wuite a while if there has
+	   been a recent recovery
+	*/
+	alarm(0);
+
 	len = offsetof(struct ctdb_control_ip_iface, iface) + strlen(argv[1]) + 1;
 	pub = talloc_size(tmp_ctx, len); 
 	CTDB_NO_MEMORY(ctdb, pub);
@@ -1726,27 +1730,6 @@ static int control_addip(struct ctdb_context *ctdb, int argc, const char **argv)
 		return ret;
 	}
 
-	if (i == ips->num) {
-		/* no one has this ip so we claim it */
-		pnn  = options.pnn;
-	} else {
-		pnn  = ips->ips[i].pnn;
-	}
-
-	do {
-		ret = move_ip(ctdb, &addr, pnn);
-		if (ret != 0) {
-			DEBUG(DEBUG_ERR,("Failed to move ip to node %d. wait 3 seconds and try again.\n", pnn));
-			sleep(3);
-			retries++;
-		}
-	} while (retries < 5 && ret != 0);
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR,("Failed to move ip to node %d. Giving up.\n", pnn));
-		talloc_free(tmp_ctx);
-		return ret;
-	}
-
 	do {
 		ret = control_ipreallocate(ctdb, argc, argv);
 		if (ret != 0) {


-- 
CTDB repository


More information about the samba-cvs mailing list