[SCM] CTDB repository - branch 2.5 updated - ctdb-2.5.3-67-g00534e6

Amitay Isaacs amitay at samba.org
Thu Jul 3 20:18:17 MDT 2014


The branch, 2.5 has been updated
       via  00534e6ca28d8a2e47118338ca1cda4d3bd79486 (commit)
       via  939aacb33d2b70941bf55f18a7e8ca43f2ca0b81 (commit)
      from  b3df79485915d692cf685c812067f55ebf0b5ea1 (commit)

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


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

    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
    
    (Imported from commit a7c55007659ab768293f15c5f5fc00c5d9e5c814)

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

    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>
    
    (Imported from commit b0c191e5de15e54646b02925e37458d6a56db015)

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

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


Changeset truncated at 500 lines:

diff --git a/config/debug-hung-script.sh b/config/debug-hung-script.sh
index 63d695f..34e957c 100755
--- a/config/debug-hung-script.sh
+++ b/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/tests/complex/90_debug_hung_script.sh b/tests/complex/90_debug_hung_script.sh
index ef6216c..5438449 100755
--- a/tests/complex/90_debug_hung_script.sh
+++ b/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"
 


-- 
CTDB repository


More information about the samba-cvs mailing list