[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-446-g6d7a6d8

Ronnie Sahlberg sahlberg at samba.org
Mon Jul 11 02:22:23 MDT 2011


The branch, 1.2 has been updated
       via  6d7a6d81b9de77b1d0b1bd42e870e99922ef9f76 (commit)
       via  f9f28ff32c3d110b2609a277aa6f71211e3eb7b6 (commit)
       via  704550edf80031baefd0341712e60aea31b27c5c (commit)
       via  393b0b7155ef6ffbf2c73526cc318082bc7bd953 (commit)
       via  7f5596fc3e07f1f870c2bee7a3547544c3e3646e (commit)
      from  d40330453854d81d182112b49f5f6f2e0814b231 (commit)

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


- Log -----------------------------------------------------------------
commit 6d7a6d81b9de77b1d0b1bd42e870e99922ef9f76
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Jul 11 17:41:12 2011 +1000

    new version 1.2.31

commit f9f28ff32c3d110b2609a277aa6f71211e3eb7b6
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 5 11:32:06 2011 +1000

    Eventscript functions: optimise ctdb_check_tcp_ports() and add debug.
    
    ctdb_check_tcp_ports() runs "netstat -a -t -n" in a loop for each
    port.  There are 2 problems with this:
    
    * Netstat is run on each loop iteration when it need only be run once.
    
    * The -a option is used to list all connections but the function only
      cares about the listening ports.  There may be many thousands of
      non-listening ports to grep through.
    
    This changes ctdb_check_tcp_ports() to run netstat with the -l option
    instead of the -a option.  It also only runs netstat once before the
    main loop.
    
    When a port is found to not be listening the output of the netstat
    command is now dumped to help with debugging.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 704550edf80031baefd0341712e60aea31b27c5c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Jul 5 06:29:00 2011 +1000

    Add log output to wipedb and backupdb
    CQ S1025379

commit 393b0b7155ef6ffbf2c73526cc318082bc7bd953
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Aug 3 13:34:27 2010 +1000

    When trying to re-balance the ip assignment and shuffle ips from
    nodes with many addresses to nodes with few addresses,
    loop up to num_ips+5 times instead of only 5 times.
    
    When we have very many public ips per node, we might need to loop more than
    5 times or else we will exit without reaching optimal balance.

commit 7f5596fc3e07f1f870c2bee7a3547544c3e3646e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Jun 28 15:39:38 2011 +1000

    change the name for the key for the record where we stoire the public address config from public-addresses... to public_addresses...
    
    CQ1019030

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

Summary of changes:
 config/events.d/00.ctdb    |    2 +-
 config/functions           |   29 ++++++++++++++++++++---------
 packaging/RPM/ctdb.spec.in |   14 +++++++++++++-
 server/ctdb_takeover.c     |   14 ++++++++++----
 tools/ctdb.c               |    5 +++++
 5 files changed, 49 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 61f2031..4f97185 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -14,7 +14,7 @@ loadconfig
 
 update_config_from_tdb() {
 	# Pull optional ctdb configuration data out of config.tdb
-	PUBLICADDRESSESKEY='public-addresses:node#'`ctdb -t 1 xpnn|sed -e "s/.*://"`
+	PUBLICADDRESSESKEY='public_addresses:node#'`ctdb -t 1 xpnn|sed -e "s/.*://"`
 	rm -f $CTDB_VARDIR/state/public_addresses
 	ctdb pfetch config.tdb $PUBLICADDRESSESKEY $CTDB_VARDIR/state/public_addresses 2>/dev/null
 	[ "$?" = "0" ] && [ `stat --format="%s" /etc/ctdb/state/public_addresses` != "0" ] && [ ! -z "$CTDB_PUBLIC_ADDRESSES" ] && {
diff --git a/config/functions b/config/functions
index 6c44fb8..567191d 100755
--- a/config/functions
+++ b/config/functions
@@ -191,15 +191,26 @@ ctdb_check_directories() {
 # check a set of tcp ports
 # usage: ctdb_check_tcp_ports <ports...>
 ######################################################
-ctdb_check_tcp_ports() {
+ctdb_check_tcp_ports()
+{
+    _cmd='netstat -l -t -n'
+    _ns=$($_cmd)
+    for _p ; do  # process each function argument (port)
+	for _a in '0\.0\.0\.0' '::' ; do
+	    _pat="[[:space:]]${_a}:${_p}[[:space:]]+[^[:space:]]+[[:space:]]+LISTEN"
+	    if echo "$_ns" | grep -E -q "$_pat" ; then
+		# We matched the port, so process next port
+		continue 2
+	    fi
+	done
 
-    for p ; do
-	if ! netstat -a -t -n | grep -q "0\.0\.0\.0:$p .*LISTEN" ; then
-            if ! netstat -a -t -n | grep -q ":::$p .*LISTEN" ; then
-		echo "ERROR: $service_name tcp port $p is not responding"
-		return 1
-            fi
-	fi
+	# We didn't match the port, so flag an error, print some debug
+	cat <<EOF
+ERROR: $service_name tcp port $_p is not responding
+$_cmd shows this output:
+$_ns
+EOF
+	return 1
     done
 }
 
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 13b843a..ce6b163 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.30
+Version: 1.2.31
 Release: 1GITHASH
 Epoch: 0
 License: GNU GPL version 3
@@ -144,6 +144,18 @@ development libraries for ctdb
 %{_libdir}/libctdb.a
 
 %changelog
+* Mon Jul 11 2011 : Version 1.2.31
+ - Add extra logging to the debug commands "wipedb" and "backupdb"
+ - Try numips+5 times when rebalancing ips.
+ - Change the name for hte key where we store the public address config.
+   S1019030
+ - Remove benign log message
+   S1024495
+ - Fix that 'onnode con ...' works
+   S1024277
+ - Add extra debug to netstat to capture a bug where samba drops off the
+   netstat output.
+   S1024874
 * Mon May 30 2011 : Version 1.2.30
  - Add LDBTOOL
  - workaround funky vlan issue with kernel dropping routes
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index c824434..ddbc77f 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -1260,7 +1260,7 @@ create_merged_ip_list(struct ctdb_context *ctdb)
  */
 int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
 {
-	int i, num_healthy, retries;
+  int i, num_healthy, retries, num_ips;
 	struct ctdb_public_ip ip;
 	struct ctdb_public_ipv4 ipv4;
 	uint32_t mask, *nodes;
@@ -1312,6 +1312,12 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
 	*/
 	all_ips = create_merged_ip_list(ctdb);
 
+	/* Count how many ips we have */
+	num_ips = 0;
+	for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
+		num_ips++;
+	}
+
 	/* If we want deterministic ip allocations, i.e. that the ip addresses
 	   will always be allocated the same way for a specific set of
 	   available/unavailable nodes.
@@ -1445,11 +1451,11 @@ try_again:
 		/* if the spread between the smallest and largest coverage by
 		   a node is >=2 we steal one of the ips from the node with
 		   most coverage to even things out a bit.
-		   try to do this at most 5 times  since we dont want to spend
-		   too much time balancing the ip coverage.
+		   try to do this a limited number of times since we dont
+		   want to spend too much time balancing the ip coverage.
 		*/
 		if ( (maxnum > minnum+1)
-		  && (retries < 5) ){
+		  && (retries < (num_ips + 5)) ){
 			struct ctdb_public_ip_list *tmp;
 
 			/* mark one of maxnode's vnn's as unassigned and try
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 674622a..ec9481e 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -4142,6 +4142,9 @@ done:
 			DEBUG(DEBUG_ERR,("close failed: %s\n", strerror(errno)));
 		}
 	}
+
+	DEBUG(DEBUG_ERR,("Database acked up to %s\n", argv[1]));
+
 	talloc_free(tmp_ctx);
 	return status;
 }
@@ -4585,6 +4588,8 @@ static int control_wipedb(struct ctdb_context *ctdb, int argc,
 		return -1;
 	}
 
+	DEBUG(DEBUG_ERR, ("Database wiped.\n"));
+
 	talloc_free(tmp_ctx);
 	return 0;
 }


-- 
CTDB repository


More information about the samba-cvs mailing list