[SCM] CTDB repository - branch master updated - ctdb-1.0.114-176-g1e08d15

Ronnie Sahlberg sahlberg at samba.org
Fri Jul 30 00:33:57 MDT 2010


The branch, master has been updated
       via  1e08d1578d1960fcfc5fdd85492fbd6d194e5e94 (commit)
       via  b4391c00476cde74101736986dfcd2be6c959edc (commit)
       via  bb1d2bd31073304fc203868517144f61d12b7fc2 (commit)
       via  e665cfde03fc9ec2264e99512ed5470872a2fd04 (commit)
       via  72d6914ee913272312d7b68f1be5ad05ad06587d (commit)
       via  70877b2e7f8fd0d46899bbeca2c6caad6e6e6820 (commit)
       via  44009e02a661d4a1e14246f650974fc4ed7a07c9 (commit)
       via  e6cf0e8f14f4263fbd8b995418909199924827e9 (commit)
       via  cfea357c9b2142c8cd8cac1ee712d40b188793e1 (commit)
       via  dfdaa446cf256854ff6d267dceeb86fbee8bb188 (commit)
       via  8f17731dea4287d4f9b21dc58c1bdf26c8a0e628 (commit)
       via  509e2e89ae233a0e91998d95267bf62f296a73cd (commit)
       via  372201d418f041d69646793105f6898ab12a7d91 (commit)
       via  fde760b5f39c77172308a583da4c2443b71541c9 (commit)
       via  c8651494febcb1c9e558b2002e2a72c2bf547c06 (commit)
       via  097046025176b9fcb670839d1a9f100f890e7ed2 (commit)
      from  1f453aa4b5e749468c7788afac09c6f0900ea18f (commit)

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


- Log -----------------------------------------------------------------
commit 1e08d1578d1960fcfc5fdd85492fbd6d194e5e94
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 30 08:09:40 2010 +0200

    events/10.interface: we need to mark interfaces as "up" if we don't know how to monitor them
    
    metze

commit b4391c00476cde74101736986dfcd2be6c959edc
Merge: 1f453aa4b5e749468c7788afac09c6f0900ea18f bb1d2bd31073304fc203868517144f61d12b7fc2
Author: Ronnie Sahlberg <sahlberg at sahlberg-laptop.(none)>
Date:   Fri Jul 30 16:25:40 2010 +1000

    Merge commit 'rusty/master'

commit bb1d2bd31073304fc203868517144f61d12b7fc2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jul 12 14:11:41 2010 +0200

    config/interface_modify.sh: do the echo before running the script
    
    metze
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit e665cfde03fc9ec2264e99512ed5470872a2fd04
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jul 12 14:05:51 2010 +0200

    config/interface_modify.sh: before calling a script check if it exists and is executable
    
    For non bash shells $_s_script might end with '/*'.
    
    We do the workarround this way, because it makes sense to check
    that a script is executable, before trying to execute it.
    
    metze
    
    [ This actually applies to any shell -- Rusty Russell ]
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 72d6914ee913272312d7b68f1be5ad05ad06587d
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jul 12 15:11:42 2010 +0930

    config: wrap iptables in flock to avoid concurrancy.
    
    When doing a releaseip event, we do them in parallel for all the separate
    IPs.  This creates a problem for iptables, which isn't reentrant, giving
    the strange message:
    	iptables encountered unknown error "18446744073709551615" while initializing table "filter"
    
    The worst possible symptom of this is that releaseip won't remove the rule
    which prevents us listening to clients during releaseip, and the node will be
    healthy but non-responsive.
    
    The simple workaround is to flock-wrap iptables.  Better would be to rework
    the code so we didn't need to use iptables in these paths.
    
    CQ:S1018353
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 70877b2e7f8fd0d46899bbeca2c6caad6e6e6820
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Mon Jul 12 16:08:37 2010 +0930

    ctdb: fix crash on "ctdb scriptstatus --events=releaseip"
    
    Martin accidentally typed this instead of "ctdb scriptstatus releaseip"
    and it crashes.
    
    CQ:S1018859
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 44009e02a661d4a1e14246f650974fc4ed7a07c9
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Fri Jul 2 13:21:08 2010 +1000

    version: generate RPM version from git
    
    This unifies our RPM version handling, based on tags.
    1) Tags are of form ctdb-<version>.
    2) The first <version> starts with .1.
    3) Devel versions end with .0.<patchnum>.<checksum>.devel to reliably
       identify them.
    
    This means that devel versions will correctly supersede releases and earlier
    devels, but new releases will correctly supersede older devel RPMs.
    
    Making a new release is as simple as creating a new git tag.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit e6cf0e8f14f4263fbd8b995418909199924827e9
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Jul 1 23:08:49 2010 +1000

    Report client for queue errors.
    
    We've been seeing "Invalid packet of length 0" errors, but we don't know
    what is sending them.  Add a name for each queue, and print nread.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit cfea357c9b2142c8cd8cac1ee712d40b188793e1
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Jul 1 18:33:18 2010 +1000

    tdb: improve logging
    
    When tdb throws an error, we didn't report the name of the tdb; we should.
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit dfdaa446cf256854ff6d267dceeb86fbee8bb188
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Jul 1 21:46:55 2010 +1000

    ctdb_freeze: extend db priority hack to cover serverid.tdb deadlock.
    
    We discovered that recent smbd locks the serverid tdb while
    holding a lock on another tdb (locking.tdb):
      7: POSIX  ADVISORY  WRITE smbd-2224318 locking.tdb.0 10600 10600
      22: -> POSIX  ADVISORY  READ  smbd-2224318 serverid.tdb.0 26580 26580
    
    The result is a deadlock against the ctdb_freeze code called for
    recovery.  We extend the "notify" workaround to this case, too.
    
    BZ:65158
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 8f17731dea4287d4f9b21dc58c1bdf26c8a0e628
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 22 22:55:20 2010 +0930

    speed startup: with --sloppy-start, cut initial election timeout to 1/2 second.
    
    Seconds between ctdbd first log message and node healthy:
    BEFORE:	4.03
    AFTER: 2.02
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 509e2e89ae233a0e91998d95267bf62f296a73cd
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 22 22:52:34 2010 +0930

    speed startup: add --sloppy-start.
    
    The extra recovery interval wait was introduced in 821333afb458 but no
    explanation was provided in that message.  Nonetheless, if starting
    the entire cluster for the first time, it should be safe to skip this.
    
    We use the commandline arg --sloppy-start which should discourage
    people from using it outside testing.
    
    Seconds between ctdbd first log message and node healthy:
    BEFORE:	16.10
    AFTER: 4.03
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 372201d418f041d69646793105f6898ab12a7d91
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 22 22:50:45 2010 +0930

    speed startup: run startup immediately after recovery finished.
    
    Seconds between ctdbd first log message and node healthy:
    BEFORE:	17.08
    AFTER: 16.10
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit fde760b5f39c77172308a583da4c2443b71541c9
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 22 22:50:35 2010 +0930

    speed startup: don't wait a full recovery interval if we've already waited
    
    We currently sleep for one second, whether or not we've already slept.
    Change this to sleep for the remainder of the second, if at all.
    
    Seconds between ctdbd first log message and node healthy:
    BEFORE:	18.09
    AFTER: 17.08
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit c8651494febcb1c9e558b2002e2a72c2bf547c06
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 22 22:50:07 2010 +0930

    speed startup: immediately run first monitor event after startup.
    
    Once we've done a startup, we need to run a monitor event successfully
    to be marked as healthy.  Rather than wait the usual 5 seconds, run it
    immediately (which will then reset next_interval to 5 seconds).
    
    Seconds between ctdbd first log message and node healthy:
    BEFORE:	23.58
    AFTER: 18.09
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 097046025176b9fcb670839d1a9f100f890e7ed2
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Tue Jun 22 22:50:23 2010 +0930

    speed startup: alter recovery loop
    
    We do a recovery on startup.  But the code does:
       Sleep for ctdb->tunable.recover_interval.
       Check for recovery.
    
    We want to do it in the other order.  This is best done by extracting
    the loop into a separate "main_loop" function.
    
    Seconds between ctdbd first log message and node healthy:
    BEFORE:	24.09
    AFTER: 23.58
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

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

Summary of changes:
 client/ctdb_client.c         |    2 +-
 common/ctdb_io.c             |   59 ++++++++---
 config/events.d/10.interface |    8 ++
 config/functions             |    6 +
 config/interface_modify.sh   |    5 +-
 include/ctdb_private.h       |    4 +-
 lib/util/db_wrap.c           |    5 +-
 packaging/RPM/ctdb.spec.in   |    4 +-
 packaging/RPM/makerpms.sh    |   36 ++++++--
 server/ctdb_daemon.c         |    3 +-
 server/ctdb_freeze.c         |    8 +-
 server/ctdb_monitor.c        |    6 +-
 server/ctdb_recoverd.c       |  221 ++++++++++++++++++++++-------------------
 server/ctdb_traverse.c       |    3 +-
 server/ctdbd.c               |    2 +
 tcp/tcp_connect.c            |    2 +-
 tcp/tcp_init.c               |    2 +-
 tools/ctdb.c                 |    4 +
 18 files changed, 238 insertions(+), 142 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 01ceb91..adba17c 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -281,7 +281,7 @@ int ctdb_socket_connect(struct ctdb_context *ctdb)
 
 	ctdb->daemon.queue = ctdb_queue_setup(ctdb, ctdb, ctdb->daemon.sd, 
 					      CTDB_DS_ALIGNMENT, 
-					      ctdb_client_read_cb, ctdb);
+					      ctdb_client_read_cb, ctdb, "to-ctdbd");
 	return 0;
 }
 
diff --git a/common/ctdb_io.c b/common/ctdb_io.c
index c9ac989..102f0b6 100644
--- a/common/ctdb_io.c
+++ b/common/ctdb_io.c
@@ -28,6 +28,7 @@
 #include "system/filesys.h"
 #include "../include/ctdb_private.h"
 #include "../include/ctdb_client.h"
+#include <stdarg.h>
 
 /* structures for packet queueing - see common/ctdb_io.c */
 struct ctdb_partial {
@@ -53,6 +54,7 @@ struct ctdb_queue {
 	void *private_data;
 	ctdb_queue_cb_fn_t callback;
 	bool *destroyed;
+	const char *name;
 };
 
 
@@ -62,13 +64,28 @@ int ctdb_queue_length(struct ctdb_queue *queue)
 	return queue->out_queue_length;
 }
 
+static void dump_packet(unsigned char *data, size_t len)
+{
+	size_t i;
+	char *p = talloc_array(NULL, char, len*3 + 1);
+	if (!p) {
+		DEBUG(DEBUG_CRIT,("Packet talloc fail"));
+		return;
+	}
+
+	for (i = 0; i < len; i++)
+		sprintf(p + i*3, " %02x", data[i]);
+	DEBUG(DEBUG_CRIT,("Contents: %s\n", p));
+	talloc_free(p);
+}
+
 /*
   called when an incoming connection is readable
 */
 static void queue_io_read(struct ctdb_queue *queue)
 {
 	int num_ready = 0;
-	ssize_t nread;
+	ssize_t nread, totread, partlen;
 	uint8_t *data, *data_base;
 
 	if (ioctl(queue->fd, FIONREAD, &num_ready) != 0) {
@@ -84,17 +101,19 @@ static void queue_io_read(struct ctdb_queue *queue)
 						  num_ready + queue->partial.length);
 
 	if (queue->partial.data == NULL) {
-		DEBUG(DEBUG_ERR,("read error alloc failed for %u\n", 
-			 num_ready + queue->partial.length));
+		DEBUG(DEBUG_ERR,("%s: read error alloc failed for %u\n",
+			queue->name, num_ready + queue->partial.length));
 		goto failed;
 	}
 
 	nread = read(queue->fd, queue->partial.data + queue->partial.length, num_ready);
 	if (nread <= 0) {
-		DEBUG(DEBUG_ERR,("read error nread=%d\n", (int)nread));
+		DEBUG(DEBUG_ERR,("%s: read error nread=%d\n",
+				 queue->name, (int)nread));
 		goto failed;
 	}
-
+	totread = nread;
+	partlen = queue->partial.length;
 
 	data = queue->partial.data;
 	nread += queue->partial.length;
@@ -120,12 +139,15 @@ static void queue_io_read(struct ctdb_queue *queue)
 		len = *(uint32_t *)data;
 		if (len == 0) {
 			/* bad packet! treat as EOF */
-			DEBUG(DEBUG_CRIT,("Invalid packet of length 0\n"));
+			DEBUG(DEBUG_CRIT,("%s: Invalid packet of length 0 (nread = %zu, totread = %zu, partlen = %zu)\n",
+					  queue->name, nread, totread, partlen));
+			dump_packet(data_base, totread + partlen);
 			goto failed;
 		}
 		d2 = talloc_memdup(queue, data, len);
 		if (d2 == NULL) {
-			DEBUG(DEBUG_ERR,("read error memdup failed for %u\n", len));
+			DEBUG(DEBUG_ERR,("%s: read error memdup failed for %u\n",
+					 queue->name, len));
 			/* sigh */
 			goto failed;
 		}
@@ -150,8 +172,8 @@ static void queue_io_read(struct ctdb_queue *queue)
 		} else {
 			queue->partial.data = talloc_memdup(queue, data, nread);
 			if (queue->partial.data == NULL) {
-				DEBUG(DEBUG_ERR,("read error memdup partial failed for %u\n", 
-					 (unsigned)nread));
+				DEBUG(DEBUG_ERR,("%s: read error memdup partial failed for %u\n",
+						 queue->name, (unsigned)nread));
 				goto failed;
 			}
 			queue->partial.length = nread;
@@ -303,19 +325,19 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
 		switch (hdr->operation) {
 		case CTDB_REQ_CONTROL: {
 			struct ctdb_req_control *c = (struct ctdb_req_control *)hdr;
-			talloc_set_name(pkt, "ctdb_queue_pkt: control opcode=%u srvid=%llu datalen=%u",
-					(unsigned)c->opcode, (unsigned long long)c->srvid, (unsigned)c->datalen);
+			talloc_set_name(pkt, "ctdb_queue_pkt: %s control opcode=%u srvid=%llu datalen=%u",
+					queue->name, (unsigned)c->opcode, (unsigned long long)c->srvid, (unsigned)c->datalen);
 			break;
 		}
 		case CTDB_REQ_MESSAGE: {
 			struct ctdb_req_message *m = (struct ctdb_req_message *)hdr;
-			talloc_set_name(pkt, "ctdb_queue_pkt: message srvid=%llu datalen=%u",
-					(unsigned long long)m->srvid, (unsigned)m->datalen);
+			talloc_set_name(pkt, "ctdb_queue_pkt: %s message srvid=%llu datalen=%u",
+					queue->name, (unsigned long long)m->srvid, (unsigned)m->datalen);
 			break;
 		}
 		default:
-			talloc_set_name(pkt, "ctdb_queue_pkt: operation=%u length=%u src=%u dest=%u",
-					(unsigned)hdr->operation, (unsigned)hdr->length, 
+			talloc_set_name(pkt, "ctdb_queue_pkt: %s operation=%u length=%u src=%u dest=%u",
+					queue->name, (unsigned)hdr->operation, (unsigned)hdr->length,
 					(unsigned)hdr->srcnode, (unsigned)hdr->destnode);
 			break;
 		}
@@ -364,12 +386,17 @@ struct ctdb_queue *ctdb_queue_setup(struct ctdb_context *ctdb,
 				    TALLOC_CTX *mem_ctx, int fd, int alignment,
 				    
 				    ctdb_queue_cb_fn_t callback,
-				    void *private_data)
+				    void *private_data, const char *fmt, ...)
 {
 	struct ctdb_queue *queue;
+	va_list ap;
 
 	queue = talloc_zero(mem_ctx, struct ctdb_queue);
 	CTDB_NO_MEMORY_NULL(ctdb, queue);
+	va_start(ap, fmt);
+	queue->name = talloc_vasprintf(mem_ctx, fmt, ap);
+	va_end(ap);
+	CTDB_NO_MEMORY_NULL(ctdb, queue->name);
 
 	queue->ctdb = ctdb;
 	queue->fd = fd;
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index 3ef6594..de2f92a 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -78,9 +78,17 @@ monitor_interfaces()
 	    case $IFACE in
 	    lo*)
 		# loopback is always working
+		test -n "$OLDLINK" && {
+		    ok=1 # we only set ok for interfaces known to ctdbd
+		    ctdb setifacelink $IFACE up
+		}
 		;;
 	    ib*)
 		# we dont know how to test ib links
+		test -n "$OLDLINK" && {
+		    ok=1 # we only set ok for interfaces known to ctdbd
+		    ctdb setifacelink $IFACE up
+		}
 		;;
 	    *)
 		[ -z "$IFACE" ] || {
diff --git a/config/functions b/config/functions
index 73ae0c0..69c5ce1 100755
--- a/config/functions
+++ b/config/functions
@@ -761,6 +761,12 @@ ipv4_is_valid_addr()
 	return 0;
 }
 
+# iptables doesn't like being re-entered, so flock-wrap it.
+iptables()
+{
+	flock -w 30 /var/ctdb/iptables-ctdb.flock /sbin/iptables "$@"
+}
+
 ########################################################
 # load a site local config file
 ########################################################
diff --git a/config/interface_modify.sh b/config/interface_modify.sh
index 738530b..27e06ea 100755
--- a/config/interface_modify.sh
+++ b/config/interface_modify.sh
@@ -68,12 +68,15 @@ delete_ip_from_iface()
 
 		local _s_script=""
 		for _s_script in $_s_script_dir/*; do
+			test -x "$_s_script" || {
+				continue
+			}
+			echo "call $_s_script '$_iface' '$_s_ip' '$_s_maskbits'"
 			$_s_script "$_iface" "$_s_ip" "$_s_maskbits" || {
 				ret=$?
 				echo "$_s_script '$_iface' '$_s_ip' '$_s_maskbits' - failed - $ret"
 				_failed=1
 			}
-			echo "call $_s_script '$_iface' '$_s_ip' '$_s_maskbits'"
 		done
 
 	    done
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 642a55e..ca3d613 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -676,7 +676,8 @@ struct ctdb_queue *ctdb_queue_setup(struct ctdb_context *ctdb,
 				    TALLOC_CTX *mem_ctx, int fd, int alignment,
 				    
 				    ctdb_queue_cb_fn_t callback,
-				    void *private_data);
+				    void *private_data, const char *fmt, ...)
+	PRINTF_ATTRIBUTE(7,8);
 
 /*
   allocate a packet for use in client<->daemon communication
@@ -1299,6 +1300,7 @@ int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb);
 int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata);
 
 extern int script_log_level;
+extern bool fast_start;
 
 int32_t ctdb_control_get_event_script_status(struct ctdb_context *ctdb,
 					     uint32_t call_type,
diff --git a/lib/util/db_wrap.c b/lib/util/db_wrap.c
index 7f5240e..9c4f6dd 100644
--- a/lib/util/db_wrap.c
+++ b/lib/util/db_wrap.c
@@ -48,9 +48,10 @@ static void log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const ch
 {
 	if (level <= TDB_DEBUG_ERROR) {
 		va_list ap;
-
+		char newfmt[strlen(tdb_name(tdb)) + 1 + strlen(fmt) + 1];
+		sprintf(newfmt, "%s:%s", tdb_name(tdb), fmt);
 		va_start(ap, fmt);
-		do_debug_v(fmt, ap);
+		do_debug_v(newfmt, ap);
 		va_end(ap);
 	}
 }
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 6706672..833dae8 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,8 +3,8 @@ Name: ctdb
 Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
-Version: 1.9
-Release: 1GITHASH
+Version: @VERSION@
+Release: 1
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
diff --git a/packaging/RPM/makerpms.sh b/packaging/RPM/makerpms.sh
index a51099c..266fcfb 100755
--- a/packaging/RPM/makerpms.sh
+++ b/packaging/RPM/makerpms.sh
@@ -44,18 +44,38 @@ SPECFILE="ctdb.spec"
 SPECFILE_IN="ctdb.spec.in"
 RPMBUILD="rpmbuild"
 
-GITHASH=".$(git log --pretty=format:%h -1)"
-
-if test "x$USE_GITHASH" = "xno" ; then
-	GITHASH=""
-fi
-
-sed -e s/GITHASH/${GITHASH}/g \
+# We use tags and determine the version, as follows:
+# ctdb-0.9.1  (First release of 0.9).
+# ctdb-0.9.23 (23rd minor release of the 112 version)
+#
+# If we're not directly on a tag, this is a devel release; we append
+# .0.<patchnum>.<checksum>.devel to the release.
+TAG=`git describe`
+case "$TAG" in
+    ctdb-*)
+	TAG=${TAG##ctdb-}
+	case "$TAG" in
+	    *-*-g*) # 0.9-168-ge6cf0e8
+		# Not exactly on tag: devel version.
+		VERSION=`echo "$TAG" | sed 's/\([^-]\+\)-\([0-9]\+\)-\(g[0-9a-f]\+\)/\1.0.\2.\3.devel/'`
+		;;
+	    *)
+		# An actual release version
+		VERSION=$TAG
+		;;
+	esac
+	;;
+    *)
+	echo Invalid tag "$TAG" >&2
+	exit 1
+	;;
+esac
+
+sed -e s/@VERSION@/$VERSION/g \
 	< ${DIRNAME}/${SPECFILE_IN} \
 	> ${DIRNAME}/${SPECFILE}
 
 VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
-RELEASE=$(grep ^Release ${DIRNAME}/${SPECFILE} | sed -e 's/^Release:\ \+//')
 
 if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
 	GZIP="gzip -9 --rsyncable"
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index 0a57a8a..7a31a13 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -630,7 +630,8 @@ static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde,
 	DLIST_ADD(ctdb->client_pids, client_pid);
 
 	client->queue = ctdb_queue_setup(ctdb, client, fd, CTDB_DS_ALIGNMENT, 
-					 ctdb_daemon_read_cb, client);
+					 ctdb_daemon_read_cb, client,
+					 "client-%u", client->pid);
 
 	talloc_set_destructor(client, ctdb_client_destructor);
 	talloc_set_destructor(client_pid, ctdb_clientpid_destructor);
diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c
index 70333b0..e641ef3 100644
--- a/server/ctdb_freeze.c
+++ b/server/ctdb_freeze.c
@@ -26,6 +26,10 @@
 #include "lib/util/dlinklist.h"
 #include "db_wrap.h"
 
+static bool later_db(const char *name)
+{
+	return (strstr(name, "notify") || strstr(name, "serverid"));
+}
 
 /*
   lock all databases
@@ -43,7 +47,7 @@ static int ctdb_lock_all_databases(struct ctdb_context *ctdb, uint32_t priority)
 		if (ctdb_db->priority != priority) {
 			continue;
 		}
-		if (strstr(ctdb_db->db_name, "notify") != NULL) {
+		if (later_db(ctdb_db->db_name)) {
 			continue;
 		}
 		DEBUG(DEBUG_INFO,("locking database 0x%08x priority:%u %s\n", ctdb_db->db_id, ctdb_db->priority, ctdb_db->db_name));
@@ -56,7 +60,7 @@ static int ctdb_lock_all_databases(struct ctdb_context *ctdb, uint32_t priority)
 		if (ctdb_db->priority != priority) {
 			continue;
 		}
-		if (strstr(ctdb_db->db_name, "notify") == NULL) {
+		if (!later_db(ctdb_db->db_name)) {
 			continue;
 		}
 		DEBUG(DEBUG_INFO,("locking database 0x%08x priority:%u %s\n", ctdb_db->db_id, ctdb_db->priority, ctdb_db->db_name));
diff --git a/server/ctdb_monitor.c b/server/ctdb_monitor.c
index 48a3f32..3343501 100644
--- a/server/ctdb_monitor.c
+++ b/server/ctdb_monitor.c
@@ -202,7 +202,7 @@ static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p
 	} else if (status == 0) {
 		DEBUG(DEBUG_NOTICE,("startup event OK - enabling monitoring\n"));
 		ctdb->done_startup = true;
-		ctdb->monitor->next_interval = 5;
+		ctdb->monitor->next_interval = 0;
 		ctdb_run_notification_script(ctdb, "startup");
 	}
 
@@ -245,7 +245,7 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
 	}
 
 
-	if (timeval_elapsed(&ctdb->last_recovery_finished) < (ctdb->tunable.rerecovery_timeout + 3)) {
+	if (!fast_start && timeval_elapsed(&ctdb->last_recovery_finished) < (ctdb->tunable.rerecovery_timeout + 3)) {
 		ctdb->db_persistent_startup_generation = INVALID_GENERATION;
 
 		DEBUG(DEBUG_NOTICE,(__location__ " wait for pending recoveries to end. Wait one more second.\n"));
@@ -301,7 +301,7 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
 
 	DEBUG(DEBUG_NOTICE,(__location__ " Recoveries finished. Running the \"startup\" event.\n"));
 	event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
-			     timeval_current_ofs(1, 0), 
+			     timeval_current(),
 			     ctdb_check_health, ctdb);
 }
 
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 3a2242e..82fe62e 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -887,10 +887,11 @@ static void ctdb_wait_handler(struct event_context *ev, struct timed_event *te,
 /*
   wait for a given number of seconds
  */
-static void ctdb_wait_timeout(struct ctdb_context *ctdb, uint32_t secs)
+static void ctdb_wait_timeout(struct ctdb_context *ctdb, double secs)
 {
 	uint32_t timed_out = 0;
-	event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(secs, 0), ctdb_wait_handler, &timed_out);
+	time_t usecs = (secs - (time_t)secs) * 1000000;
+	event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(secs, usecs), ctdb_wait_handler, &timed_out);
 	while (!timed_out) {
 		event_loop_once(ctdb->ev);
 	}
@@ -904,6 +905,7 @@ static void ctdb_election_timeout(struct event_context *ev, struct timed_event *
 {
 	struct ctdb_recoverd *rec = talloc_get_type(p, struct ctdb_recoverd);
 	rec->election_timeout = NULL;
+	fast_start = false;
 
 	DEBUG(DEBUG_WARNING,(__location__ " Election timed out\n"));
 }
@@ -2090,6 +2092,8 @@ static void election_handler(struct ctdb_context *ctdb, uint64_t srvid,
 	/* we got an election packet - update the timeout for the election */
 	talloc_free(rec->election_timeout);
 	rec->election_timeout = event_add_timed(ctdb->ev, ctdb, 
+						fast_start ?
+						timeval_current_ofs(0, 500000) :
 						timeval_current_ofs(ctdb->tunable.election_timeout, 0), 
 						ctdb_election_timeout, rec);
 
@@ -2157,6 +2161,8 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn,
 
 	talloc_free(rec->election_timeout);
 	rec->election_timeout = event_add_timed(ctdb->ev, ctdb, 
+						fast_start ?
+						timeval_current_ofs(0, 500000) :
 						timeval_current_ofs(ctdb->tunable.election_timeout, 0), 
 						ctdb_election_timeout, rec);
 
@@ -2877,14 +2883,11 @@ static int update_recovery_lock_file(struct ctdb_context *ctdb)
 	talloc_free(tmp_ctx);
 	return 0;
 }
-		
-/*
-  the main monitoring loop
- */
-static void monitor_cluster(struct ctdb_context *ctdb)
+
+static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
+		      TALLOC_CTX *mem_ctx)
 {
 	uint32_t pnn;
-	TALLOC_CTX *mem_ctx=NULL;
 	struct ctdb_node_map *nodemap=NULL;
 	struct ctdb_node_map *recmaster_nodemap=NULL;
 	struct ctdb_node_map **remote_nodemaps=NULL;
@@ -2892,57 +2895,8 @@ static void monitor_cluster(struct ctdb_context *ctdb)
 	struct ctdb_vnn_map *remote_vnnmap=NULL;
 	int32_t debug_level;
 	int i, j, ret;
-	struct ctdb_recoverd *rec;
-
-	DEBUG(DEBUG_NOTICE,("monitor_cluster starting\n"));
-
-	rec = talloc_zero(ctdb, struct ctdb_recoverd);
-	CTDB_NO_MEMORY_FATAL(ctdb, rec);
-
-	rec->ctdb = ctdb;
-
-	rec->priority_time = timeval_current();
-
-	/* register a message port for sending memory dumps */
-	ctdb_client_set_message_handler(ctdb, CTDB_SRVID_MEM_DUMP, mem_dump_handler, rec);
-
-	/* register a message port for recovery elections */
-	ctdb_client_set_message_handler(ctdb, CTDB_SRVID_RECOVERY, election_handler, rec);
-
-	/* when nodes are disabled/enabled */
-	ctdb_client_set_message_handler(ctdb, CTDB_SRVID_SET_NODE_FLAGS, monitor_handler, rec);
-
-	/* when we are asked to puch out a flag change */
-	ctdb_client_set_message_handler(ctdb, CTDB_SRVID_PUSH_NODE_FLAGS, push_flags_handler, rec);
-
-	/* register a message port for vacuum fetch */
-	ctdb_client_set_message_handler(ctdb, CTDB_SRVID_VACUUM_FETCH, vacuum_fetch_handler, rec);
-
-	/* register a message port for reloadnodes  */
-	ctdb_client_set_message_handler(ctdb, CTDB_SRVID_RELOAD_NODES, reload_nodes_handler, rec);
 
-	/* register a message port for performing a takeover run */


-- 
CTDB repository


More information about the samba-cvs mailing list