[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-460-g0e0c4f2

Ronnie Sahlberg sahlberg at samba.org
Tue Aug 9 23:24:44 MDT 2011


The branch, 1.2 has been updated
       via  0e0c4f20610f085da78d7e0b7224b8c437dceaa0 (commit)
       via  fd3aeab959c866a1fd321a453164287cb42d758b (commit)
      from  8ec198b2fd2d33420714a154af99417c31cb6a9c (commit)

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


- Log -----------------------------------------------------------------
commit 0e0c4f20610f085da78d7e0b7224b8c437dceaa0
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 8 13:13:59 2011 +1000

    Eventscripts: New configuration variable CTDB_SERVICE_AUTOSTARTSTOP.
    
    Some of the current auto-start/stop logic is broken, particularly for
    Samba.  Fixing it is non-trivial.
    
    If $CTDB_SERVICE_AUTOSTARTSTOP is "yes" then auto-start/stop services
    when told to newly manage or no longer manage them.  This defaults to
    "yes".
    
    However, if using a canned configuration file that doesn't set
    $CTDB_SERVICE_AUTOSTARTSTOP then this stops the auto-start-stop logic
    from working.  Therefore, this works around CQ S1026685 - on the
    system in question another daemon controls service auto-start/stop and
    CTDB just gets in the way.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit fd3aeab959c866a1fd321a453164287cb42d758b
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Aug 5 16:39:57 2011 +1000

    Eventscripts - weaken TCP port check message if CTDB has just been started.
    
    Sometimes smbd and other services can take a while to start,
    especially when there is a lot of activity after ctdbd has just
    started.  The TCP port check can then pollute the logs with lots of
    "ERROR" messages and possibly extra debug.
    
    This creates a flag file when a service is started (but not restarted)
    and this flag is removed the first time that TCP port checks succeed
    for that service.  When a port check fails and the flag file still
    exists, a less extreme "INFO" message is printed rather than the usual
    "ERROR" message.  This means that until the node actually becomes
    healthy we see more friendly messages.
    
    The subtext is that we're hearing false positive reports "recreates"
    of CQ S1024874 (samba stopped responding on port 445) quite often when
    ctdbd is started.  This reduces the chances of people reporting such
    false recreates...
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 config/ctdb.sysconfig |    4 ++++
 config/functions      |   34 +++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb.sysconfig b/config/ctdb.sysconfig
index 011593d..b0ee474 100644
--- a/config/ctdb.sysconfig
+++ b/config/ctdb.sysconfig
@@ -286,6 +286,10 @@ CTDB_DEBUGLEVEL=ERR
 # This parameter controls how many entries we allow for this in memory log
 # CTDB_LOG_RINGBUF_SIZE=500000
 
+# Should CTDB automatically start and stop services when it is told to
+# newly manage or no longer manage them?
+CTDB_SERVICE_AUTOSTARTSTOP=yes
+
 # 
 #
 # set any default tuning options for ctdb
diff --git a/config/functions b/config/functions
index 567191d..1f50e70 100755
--- a/config/functions
+++ b/config/functions
@@ -191,8 +191,27 @@ ctdb_check_directories() {
 # check a set of tcp ports
 # usage: ctdb_check_tcp_ports <ports...>
 ######################################################
+
+# This flag file is created when a service is initially started.  It
+# is deleted the first time TCP port checks for that service succeed.
+# Until then ctdb_check_tcp_ports() prints a more subtle "error"
+# message if a port check fails.
+_ctdb_check_tcp_common ()
+{
+    _ctdb_service_started_file="$ctdb_fail_dir/$service_name.started"
+}
+
+ctdb_check_tcp_init ()
+{
+    _ctdb_check_tcp_common
+    mkdir -p "${_ctdb_service_started_file%/*}" # dirname
+    touch "$_ctdb_service_started_file"
+}
+
 ctdb_check_tcp_ports()
 {
+    _ctdb_check_tcp_common
+
     _cmd='netstat -l -t -n'
     _ns=$($_cmd)
     for _p ; do  # process each function argument (port)
@@ -205,13 +224,22 @@ ctdb_check_tcp_ports()
 	done
 
 	# We didn't match the port, so flag an error, print some debug
-	cat <<EOF
+	if [ ! -f "$_ctdb_service_started_file" ] ; then
+	    cat <<EOF
 ERROR: $service_name tcp port $_p is not responding
 $_cmd shows this output:
 $_ns
 EOF
+	else
+	    echo "INFO: $service_name tcp port $_p is not responding"
+	fi
+
 	return 1
     done
+
+    rm -f "$_ctdb_service_started_file"
+
+    return 0
 }
 
 ######################################################
@@ -701,6 +729,9 @@ is_ctdb_managed_service ()
 
 ctdb_start_stop_service ()
 {
+    # Do nothing unless configured to...
+    [ "$CTDB_SERVICE_AUTOSTARTSTOP" = "yes" ] || return 0
+
     _service_name="${1:-${service_name}}"
 
     [ "$event_name" = "monitor" ] || return 0
@@ -732,6 +763,7 @@ ctdb_service_start ()
 	service "$service_name" start || return $?
     fi
     ctdb_counter_init
+    ctdb_check_tcp_init
 }
 
 ctdb_service_stop ()


-- 
CTDB repository


More information about the samba-cvs mailing list