[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-309-gbd556db

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


The branch, 1.2 has been updated
       via  bd556db13a84327f5a6d20cc22a5fc794980a6d1 (commit)
       via  bb1618faa065c3f245a4dc5c813e0e1c0ae9edde (commit)
      from  3ec163028aebc5118efb687f2c447bdde1070f93 (commit)

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


- Log -----------------------------------------------------------------
commit bd556db13a84327f5a6d20cc22a5fc794980a6d1
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Feb 8 17:01:33 2011 +1100

    New version 1.2.20

commit bb1618faa065c3f245a4dc5c813e0e1c0ae9edde
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

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

Summary of changes:
 packaging/RPM/ctdb.spec.in |    4 ++-
 tools/ctdb.c               |   45 +++++++++++++------------------------------
 2 files changed, 17 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index a7a01ac..67003e2 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,7 +3,7 @@ Name: ctdb
 Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
-Version: 1.2.19
+Version: 1.2.20
 Release: 1GITHASH
 Epoch: 0
 License: GNU GPL version 3
@@ -143,6 +143,8 @@ development libraries for ctdb
 %{_libdir}/libctdb.a
 
 %changelog
+* Tue Feb 8 2011 : Version 1.2.20
+ - Make addip command more robust for "slow" systems.
 * Mon Jan 31 2011 : Version 1.2.19
  - Extra logging to show why CTDB dont start if it is in STOPPED state
    CQ S1021747
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 80d196a..674622a 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -1626,7 +1626,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;
@@ -1645,23 +1644,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);
@@ -1685,27 +1689,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