[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Thu Jul 3 00:20:03 MDT 2014


The branch, master has been updated
       via  a7c5500 ctdb-tests: Fix racy test for debugging hung scripts
       via  b0c191e ctdb-scripts: Always print footer when debugging hung script
      from  d70c1e4 s3-libnet: Improve error message.

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


- Log -----------------------------------------------------------------
commit a7c55007659ab768293f15c5f5fc00c5d9e5c814
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jun 26 15:16:12 2014 +1000

    ctdb-tests: Fix racy test for debugging hung scripts
    
    Debugging can still be running when a monitor event times out and
    scriptstatus output changes.
    
    When debugging a hung script to a log file, write to a temporary file
    and move the temporary file over the log file when done.  The test
    then waits for the log file to appear.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Thu Jul  3 08:19:23 CEST 2014 on sn-devel-104

commit b0c191e5de15e54646b02925e37458d6a56db015
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jun 26 14:46:54 2014 +1000

    ctdb-scripts: Always print footer when debugging hung script
    
    There shouldn't be an early exit for the "init" event.  Just make the
    "ctdb scriptstatus" call conditional.
    
    While here, move the comment about only running a single instance to
    be near locking code.  The comment is more useful there.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 ctdb/config/debug-hung-script.sh           |   21 ++++++++++++---------
 ctdb/tests/complex/90_debug_hung_script.sh |    4 ++++
 2 files changed, 16 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/debug-hung-script.sh b/ctdb/config/debug-hung-script.sh
index 63d695f..34e957c 100755
--- a/ctdb/config/debug-hung-script.sh
+++ b/ctdb/config/debug-hung-script.sh
@@ -9,10 +9,14 @@ loadconfig ctdb
 
 # Testing hook
 if [ -n "$CTDB_DEBUG_HUNG_SCRIPT_LOGFILE" ] ; then
-    exec >>"$CTDB_DEBUG_HUNG_SCRIPT_LOGFILE" 2>&1
+    tmp="${CTDB_DEBUG_HUNG_SCRIPT_LOGFILE}.part"
+    exec >>"$tmp" 2>&1
 fi
 
 (
+    # No use running several of these in parallel if, say, "releaseip"
+    # event hangs for multiple IPs.  In that case the output would be
+    # interleaved in the log and would just be confusing.
     flock --wait 2 9 || exit 1
 
     echo "===== Start of hung script debug for PID=\"$1\", event=\"$2\" ====="
@@ -38,16 +42,15 @@ fi
 	fi
     done
 
-    if [ "$2" = "init" ] ; then
-	exit 0
+    if [ "$2" != "init" ] ; then
+	echo "---- ctdb scriptstatus ${2}: ----"
+	ctdb scriptstatus "$2"
     fi
 
-    echo "---- ctdb scriptstatus ${2}: ----"
-    # No use running several of these in parallel if, say, "releaseip"
-    # event hangs for multiple IPs.  In that case the output would be
-    # interleaved in the log and would just be confusing.
-    ctdb scriptstatus "$2"
-
     echo "===== End of hung script debug for PID=\"$1\", event=\"$2\" ====="
 
+    if [ -n "$CTDB_DEBUG_HUNG_SCRIPT_LOGFILE" ] ; then
+	mv "$tmp" "$CTDB_DEBUG_HUNG_SCRIPT_LOGFILE"
+    fi
+
 ) 9>"${CTDB_VARDIR}/debug-hung-script.lock"
diff --git a/ctdb/tests/complex/90_debug_hung_script.sh b/ctdb/tests/complex/90_debug_hung_script.sh
index ef6216c..5438449 100755
--- a/ctdb/tests/complex/90_debug_hung_script.sh
+++ b/ctdb/tests/complex/90_debug_hung_script.sh
@@ -66,6 +66,10 @@ try_command_on_node $test_node chmod +x "$rc_local_f"
 
 wait_for_monitor_event $test_node
 
+echo "Waiting for debugging output to appear..."
+# Use test -s because the file is created above using mktemp
+wait_until 60 onnode $test_node test -s "$debug_output"
+
 echo "Checking output of hung script debugging..."
 try_command_on_node -v $test_node cat "$debug_output"
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list