Rev 639: no longer wait at startup for services to become available, instead in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Mon Sep 24 00:00:15 GMT 2007


------------------------------------------------------------
revno: 639
revision-id: tridge at samba.org-20070924000014-gkjpqevicat8n13y
parent: tridge at samba.org-20070923235714-iyd0qvkomu6nvrjq
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Mon 2007-09-24 10:00:14 +1000
message:
  no longer wait at startup for services to become available, instead
  set the node initially unhealthy and let the status monitoring bring the node online.
  This fixes a problem with winbindd, where it refused to start because secrets.tdb was not populated
  but we could not populate ctdbd, because the net command would not run while ctdbd was still doing startup
  and thus frozen
modified:
  config/events.d/50.samba       samba-20070601105340-vlcvnp6euoj3zdwy-3
  config/events.d/60.nfs         nfs-20070601141008-hy3h4qgbk1jd2jci-1
  server/ctdb_daemon.c           ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1
  server/ctdb_server.c           ctdb.c-20061127094323-t50f58d65iaao5of-2
  tests/ctdb_persistent.c        ctdb_persistent.c-20070921022331-6ubn98ak9nwbzjzv-1
=== modified file 'config/events.d/50.samba'
--- a/config/events.d/50.samba	2007-09-14 04:14:03 +0000
+++ b/config/events.d/50.samba	2007-09-24 00:00:14 +0000
@@ -30,10 +30,6 @@
 	# create the state directory for samba
 	/bin/mkdir -p $CTDB_BASE/state/samba
 
-	# wait for all shared directories to become available
-	smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = '  | cut -d= -f2`
-	ctdb_wait_directories "Samba" $smb_dirs	
-
 	# make sure samba is not already started
 	service smb stop > /dev/null 2>&1
 	service winbind stop > /dev/null 2>&1
@@ -48,13 +44,6 @@
 	# anything else
 	service winbind start
 	nice service smb start
-
-	# wait for the Samba tcp ports to become available
-	smb_ports=`testparm -s --parameter-name="smb ports" 2> /dev/null`
-	ctdb_wait_tcp_ports "Samba" $smb_ports
-
-	# wait for winbind to be ready
-	ctdb_wait_command "winbind" "wbinfo -p"
 	;;
 	
      takeip)

=== modified file 'config/events.d/60.nfs'
--- a/config/events.d/60.nfs	2007-09-14 04:14:03 +0000
+++ b/config/events.d/60.nfs	2007-09-24 00:00:14 +0000
@@ -17,12 +17,6 @@
 	/bin/mkdir -p $CTDB_BASE/state/nfs
 	/bin/mkdir -p $CTDB_BASE/state/statd/ip
 	/bin/mkdir -p $STATD_SHARED_DIRECTORY
-	ctdb_wait_directories "nfslock" "$STATD_SHARED_DIRECTORY"
-
-
-	# wait for all nfs exported directories to become available
-	nfs_dirs=`grep -v '^#' < /etc/exports | cut -d' ' -f1`
-	ctdb_wait_directories "NFS" $nfs_dirs
 
 	# make sure nfs is stopped before we start it, or it may get a bind error
 	service nfs stop > /dev/null 2>&1

=== modified file 'server/ctdb_daemon.c'
--- a/server/ctdb_daemon.c	2007-09-21 02:24:02 +0000
+++ b/server/ctdb_daemon.c	2007-09-24 00:00:14 +0000
@@ -61,6 +61,12 @@
 	}
 }
 
+static void print_exit_message(void)
+{
+	DEBUG(0,("CTDB daemon shutting down\n"));
+}
+
+
 /* called when the "startup" event script has finished */
 static void ctdb_start_transport(struct ctdb_context *ctdb, int status, void *p)
 {
@@ -81,6 +87,9 @@
 		exit(11);
 	}
 
+	/* Make sure we log something when the daemon terminates */
+	atexit(print_exit_message);
+
 	/* a handler for when nodes are disabled/enabled */
 	ctdb_register_message_handler(ctdb, ctdb, CTDB_SRVID_NODE_FLAGS_CHANGED, 
 				      flag_change_handler, NULL);
@@ -566,11 +575,6 @@
 	return 0;
 }
 
-static void print_exit_message(void)
-{
-	DEBUG(0,("CTDB daemon shutting down\n"));
-}
-
 /*
   start the protocol going as a daemon
 */
@@ -594,9 +598,6 @@
 		return 0;
 	}
 
-	/* Make sure we log something when the daemon terminates */
-	atexit(print_exit_message);
-
 	tdb_reopen_all(False);
 
 	if (do_fork) {

=== modified file 'server/ctdb_server.c'
--- a/server/ctdb_server.c	2007-09-21 02:24:02 +0000
+++ b/server/ctdb_server.c	2007-09-24 00:00:14 +0000
@@ -119,8 +119,8 @@
 	/* this assumes that the nodes are kept in sorted order, and no gaps */
 	node->pnn = ctdb->num_nodes;
 
-	/* nodes start out disconnected */
-	node->flags |= NODE_FLAGS_DISCONNECTED;
+	/* nodes start out disconnected and unhealthy */
+	node->flags |= NODE_FLAGS_DISCONNECTED | NODE_FLAGS_UNHEALTHY;
 
 	if (ctdb->address.address &&
 	    ctdb_same_address(&ctdb->address, &node->address)) {

=== modified file 'tests/ctdb_persistent.c'
--- a/tests/ctdb_persistent.c	2007-09-21 02:24:02 +0000
+++ b/tests/ctdb_persistent.c	2007-09-24 00:00:14 +0000
@@ -50,7 +50,7 @@
 			return;
 		}
 		
-		printf("Current value: %*.*s\n", data.dsize, data.dsize, data.dptr);
+		printf("Current value: %*.*s\n", (int)data.dsize, (int)data.dsize, data.dptr);
 		
 		if (data.dsize != 0) {
 			if (sscanf((char *)data.dptr, "Node %u Count %u", &node, &count) != 2) {



More information about the samba-cvs mailing list