[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Tue Feb 3 21:41:02 MST 2015


The branch, master has been updated
       via  0e89d58 ctdb-tests: Add new "ctdb setreclock" test
       via  5e00673f ctdb-daemon: Fix SET_RECLOCK_FILE regression
      from  362cac2 samba-tool: Create NIS enabled users and unixHomeDirectory attribute

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


- Log -----------------------------------------------------------------
commit 0e89d586b2b7fa6a165a49862d2dce0d13f8b157
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Feb 2 21:21:20 2015 +1100

    ctdb-tests: Add new "ctdb setreclock" test
    
    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): Wed Feb  4 05:40:55 CET 2015 on sn-devel-104

commit 5e00673f2d95b6257a05324d2ae068004e29ff85
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 28 18:51:42 2015 +1100

    ctdb-daemon: Fix SET_RECLOCK_FILE regression
    
    If the recovery lock file is unset then this dereferences a NULL
    pointer.  The regression is due to commit
    6f1ac7af0f87d85402d708231e45a69713bba026.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 ctdb/server/ctdb_control.c            |   3 +-
 ctdb/tests/simple/35_set_recmaster.sh | 117 ++++++++++++++++++++++++++++++++++
 2 files changed, 119 insertions(+), 1 deletion(-)
 create mode 100755 ctdb/tests/simple/35_set_recmaster.sh


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 9d835e8..7bd1d0d 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -531,7 +531,8 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 		 * master updates all nodes on each recovery - we
 		 * don't need the extra memory allocation or log
 		 * message each time. */
-		if (strcmp(discard_const(indata.dptr),
+		if (ctdb->recovery_lock_file != NULL &&
+		    strcmp(discard_const(indata.dptr),
 			   ctdb->recovery_lock_file) == 0) {
 			return 0;
 		}
diff --git a/ctdb/tests/simple/35_set_recmaster.sh b/ctdb/tests/simple/35_set_recmaster.sh
new file mode 100755
index 0000000..7c745e4
--- /dev/null
+++ b/ctdb/tests/simple/35_set_recmaster.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+test_info()
+{
+    cat <<EOF
+Verify that "ctdb setrecmaster" sets the recovery lock correctly.
+
+This test only does something when there is a recovery lock
+configured.
+EOF
+}
+
+. "${TEST_SCRIPTS_DIR}/integration.bash"
+
+ctdb_test_init "$@"
+
+set -e
+
+cluster_is_healthy
+
+# Reset configuration
+ctdb_restart_when_done
+
+get_generation ()
+{
+    local out
+    try_command_on_node any $CTDB status
+    generation=$(sed -n -e 's@^Generation:@@p' <<<"$out")
+}
+
+generation_has_changed ()
+{
+    local old_generation="$generation"
+    get_generation
+    [ "$old_generation" != "$generation" ]
+}
+
+wait_until_generation_has_changed ()
+{
+    echo
+    echo "Wait until generation has changed..."
+    wait_until 60 generation_has_changed
+}
+
+echo "Check that recovery lock is set the same on all nodes..."
+try_command_on_node -v any $CTDB -n all getreclock
+n=$(echo "$out" | sort -u | wc -l)
+if [ "$n" = 1 ] ; then
+    echo "GOOD: All nodes have the same recovery lock setting"
+else
+    echo "BAD: Recovery lock setting differs across nodes"
+    exit 1
+fi
+
+echo
+echo "Check that recovery lock is actually enabled..."
+t=$(echo "$out" | sed -e 's@^Reclock file:@@' | sort -u)
+if [ "$t" != "No reclock file used." ] ; then
+    echo "OK: Recovery lock is set"
+else
+    echo "OOPS: Recovery lock is unset. Skipping remainder of test"
+    exit 0
+fi
+
+echo
+orig_reclock=$(sed -n -e '1s@^Reclock file:@@p' <<<"$out")
+echo "Remember original recovery lock file: \"${orig_reclock}\""
+
+echo
+echo "Unset and test the recovery lock on all nodes..."
+try_command_on_node any $CTDB -n all setreclock
+try_command_on_node -v any $CTDB -n all getreclock
+t=$(sort -u <<<"$out")
+if [ "$t" = "No reclock file used." ] ; then
+    echo "GOOD: Recovery lock unset on all nodes"
+else
+    echo "BAD: Recovery lock not unset on all nodes"
+    exit 1
+fi
+
+echo
+get_generation
+echo "Current generation is ${generation}"
+
+alt="${orig_reclock}.test"
+echo
+echo "Set alternative recovery lock (${alt}) and test on all nodes..."
+try_command_on_node any $CTDB -n all setreclock "$alt"
+try_command_on_node -v any $CTDB -n all getreclock
+t=$(echo "$out" | sed -e 's@^Reclock file:@@' | sort -u)
+if [ "$t" = "$alt" ] ; then
+    echo "GOOD: Recovery lock set on all nodes"
+else
+    echo "BAD: Recovery lock not set on all nodes"
+    try_command_on_node -v any rm -v "$alt" || true
+    exit 1
+fi
+
+# Setting or updating the recovery lock file must cause a recovery
+wait_until_generation_has_changed
+echo "Current generation is ${generation}"
+
+echo
+echo "Restore and test the recovery lock on all nodes..."
+try_command_on_node any $CTDB -n all setreclock "$orig_reclock"
+try_command_on_node -v any rm -v "$alt"
+try_command_on_node -v any $CTDB -n all getreclock
+t=$(echo "$out" | sed -e 's@^Reclock file:@@' | sort -u)
+if [ "$t" = "$orig_reclock" ] ; then
+    echo "GOOD: Recovery lock restored on all nodes"
+else
+    echo "BAD: Recovery lock not restored on all nodes"
+    exit 1
+fi
+
+wait_until_generation_has_changed
+echo "Current generation is ${generation}"


-- 
Samba Shared Repository


More information about the samba-cvs mailing list