The branch, master has been updated via 4de1e3207ba ctdb-docs: Provide example commands for "ctdb event ..." via 3d5de9b26d4 ctdb-tests: Flag setup, startup, shutdown failures as test errors via 455d931a168 ctdb-tests: Dump logs on shutdown failure via 03403aacfe9 ctdb-tests: Avoid shutdown error when daemon already cleanly shut down via dc076b835f3 ctdb-tests: Rationalise node stop/start/restart via a20403adf87 ctdb-daemon: Fix signed/unsigned comparison via c9405aec703 ctdb-daemon: Check for lock count underflow via c16da0e8f09 ctdb-common: Remove signed/unsigned comparisons from 195e88cea34 s3:modules: add vfs_io_uring module
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 4de1e3207ba8e68e6101f5cd94cf18144fd5ed8f Author: Martin Schwenke <mar...@meltin.net> Date: Thu Feb 13 10:09:08 2020 +1100 ctdb-docs: Provide example commands for "ctdb event ..." The example output doesn't tell a user what command generated it. Adding the command makes the examples much more useful. Reported-by: Stefan Kania <ste...@kania-online.de> Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Tue Feb 18 04:22:56 UTC 2020 on sn-devel-184 commit 3d5de9b26d4019e25d644c6e28e5f3a58f3f8730 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Dec 6 16:12:08 2019 +1100 ctdb-tests: Flag setup, startup, shutdown failures as test errors Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 455d931a16815f3b8ee47e2b1d5aeb13e76568b2 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Dec 6 16:11:45 2019 +1100 ctdb-tests: Dump logs on shutdown failure Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 03403aacfe9664bf4cb5689ae40ac1688984d6c6 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Feb 17 16:29:05 2020 +1100 ctdb-tests: Avoid shutdown error when daemon already cleanly shut down This depends on a small amount of internal knowledge but is the cleanest way of avoiding errors for nodes that have already been shut down. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit dc076b835f30b1067155e2f440a3386331d15b5a Author: Martin Schwenke <mar...@meltin.net> Date: Wed Dec 11 21:44:28 2019 +1100 ctdb-tests: Rationalise node stop/start/restart Separate functions are not needed for stopping/starting/restarting individual nodes. The stop and start functions essentially just use onnode, though for local daemons this is embedded in local_daemons.sh. So, just provide one stop and one start function that takes an optional nodespec, defaulting to all nodes. Restarting becomes common. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit a20403adf871d2c1a646be0737935f85b55f8779 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Feb 10 17:50:30 2020 +1100 ctdb-daemon: Fix signed/unsigned comparison csbuild says: ctdb/server/ctdb_lock.c: scope_hint: In function ‘ctdb_find_lock_context’ ctdb/server/ctdb_lock.c:671:33: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit c9405aec703a9bb90236ddcb860301339a59fee6 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Feb 17 16:20:25 2020 +1100 ctdb-daemon: Check for lock count underflow This is a programming error. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit c16da0e8f09cb31baab7789ca8cd3bf34514bafc Author: Amitay Isaacs <ami...@gmail.com> Date: Mon Feb 17 17:00:47 2020 +1100 ctdb-common: Remove signed/unsigned comparisons Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> ----------------------------------------------------------------------- Summary of changes: ctdb/common/cmdline.c | 10 ++--- ctdb/doc/ctdb.1.xml | 6 ++- ctdb/include/ctdb_private.h | 2 +- ctdb/server/ctdb_lock.c | 3 ++ .../tests/CLUSTER/complex/34_nfs_tickle_restart.sh | 2 +- .../INTEGRATION/database/basics.002.attach.sh | 6 +-- .../simple/cluster.091.version_check.sh | 6 +-- ctdb/tests/local_daemons.sh | 5 ++- ctdb/tests/scripts/integration.bash | 19 ++++++--- ctdb/tests/scripts/integration_local_daemons.bash | 45 +++++++++++----------- ctdb/tests/scripts/integration_real_cluster.bash | 23 +++-------- 11 files changed, 66 insertions(+), 61 deletions(-) Changeset truncated at 500 lines: diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c index fc4cb22f066..ce368a9b241 100644 --- a/ctdb/common/cmdline.c +++ b/ctdb/common/cmdline.c @@ -39,7 +39,7 @@ struct cmdline_context { struct poptOption *options; struct cmdline_section *section; int num_sections; - int max_len; + size_t max_len; poptContext pc; int argc, arg0; const char **argv; @@ -178,7 +178,7 @@ static bool cmdline_command_check(struct cmdline_command *cmd, size_t *max_len) } if (len > *max_len) { - *max_len = (int)len; + *max_len = len; } len = strlen(cmd->msg_help); @@ -490,14 +490,14 @@ static void cmdline_usage_command(struct cmdline_context *cmdline, struct cmdline_command *cmd, bool print_all) { - int len; + size_t len; - len = (int)strlen(cmd->name); + len = strlen(cmd->name); printf(" %s ", cmd->name); if (print_all) { printf("%-*s", - cmdline->max_len-len, + (int)(cmdline->max_len-len), cmd->msg_args == NULL ? "" : cmd->msg_args); } else { printf("%s", cmd->msg_args == NULL ? "" : cmd->msg_args); diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index a204583b62c..fe2b675ff2c 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -646,9 +646,10 @@ Interface[2]: Name:eth5 Link:up References:2 (active) for each script. </para> <para> - Example output: + Example </para> <screen> +# ctdb event status legacy monitor 00.ctdb OK 0.014 Sat Dec 17 19:39:11 2016 01.reclock OK 0.013 Sat Dec 17 19:39:11 2016 05.system OK 0.029 Sat Dec 17 19:39:11 2016 @@ -684,9 +685,10 @@ Interface[2]: Name:eth5 Link:up References:2 (active) provided by CTDB. </para> <para> - Example output: + Example </para> <screen> +# ctdb event script list legacy * 00.ctdb * 01.reclock * 05.system diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index de7caef52af..405bf3b4186 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -376,7 +376,7 @@ struct ctdb_db_context { struct lock_context *lock_current; struct lock_context *lock_pending; - int lock_num_current; + unsigned int lock_num_current; struct db_hash_context *lock_log; struct ctdb_call_state *pending_calls; diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c index 5f032ae568b..478447d76f8 100644 --- a/ctdb/server/ctdb_lock.c +++ b/ctdb/server/ctdb_lock.c @@ -198,6 +198,9 @@ static int ctdb_lock_context_destructor(struct lock_context *lock_ctx) } else { DLIST_REMOVE(lock_ctx->ctdb->lock_current, lock_ctx); } + if (lock_ctx->ctdb_db->lock_num_current == 0) { + ctdb_fatal(NULL, "Lock count is 0 before decrement\n"); + } lock_ctx->ctdb_db->lock_num_current--; CTDB_DECREMENT_STAT(lock_ctx->ctdb, locks.num_current); CTDB_DECREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_current); diff --git a/ctdb/tests/CLUSTER/complex/34_nfs_tickle_restart.sh b/ctdb/tests/CLUSTER/complex/34_nfs_tickle_restart.sh index 04d87af1b2e..5ab8a34faec 100755 --- a/ctdb/tests/CLUSTER/complex/34_nfs_tickle_restart.sh +++ b/ctdb/tests/CLUSTER/complex/34_nfs_tickle_restart.sh @@ -59,7 +59,7 @@ rn=$(awk -F'|' -v test_node=$test_node \ '$2 != test_node { print $2 ; exit }' <<<"$listnodes_output") echo "Restarting CTDB on node ${rn}" -restart_ctdb_1 $rn +ctdb_nodes_restart "$rn" # In some theoretical world this is racy. In practice, the node will # take quite a while to become healthy, so this will beat any diff --git a/ctdb/tests/INTEGRATION/database/basics.002.attach.sh b/ctdb/tests/INTEGRATION/database/basics.002.attach.sh index b9ae9481d91..ae09741f980 100755 --- a/ctdb/tests/INTEGRATION/database/basics.002.attach.sh +++ b/ctdb/tests/INTEGRATION/database/basics.002.attach.sh @@ -86,7 +86,7 @@ testdb3="test_replicated.tdb" test_node="0" echo "Shutting down node $test_node" -stop_ctdb_1 "$test_node" +ctdb_nodes_stop "$test_node" sleep 1 wait_until_node_has_status 1 recovered try_command_on_node -v 1 $CTDB status @@ -110,7 +110,7 @@ done echo echo "Start node $test_node" -start_ctdb_1 "$test_node" +ctdb_nodes_start "$test_node" sleep 1 wait_until_ready @@ -124,7 +124,7 @@ check_db $test_node $testdb3 REPLICATED echo echo "Restarting node $test_node" -restart_ctdb_1 "$test_node" +ctdb_nodes_restart "$test_node" sleep 1 wait_until_ready diff --git a/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh b/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh index 4076047a8fe..fa934e8bef1 100755 --- a/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh +++ b/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh @@ -33,7 +33,7 @@ export CTDB_TEST_SAMBA_VERSION=$(( (major << 16) | minor )) printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \ "$test_node" \ "$CTDB_TEST_SAMBA_VERSION" -restart_ctdb_1 "$test_node" +ctdb_nodes_restart "$test_node" wait_until_ready echo "GOOD: ctdbd restarted successfully on node ${test_node}" @@ -46,7 +46,7 @@ export CTDB_TEST_SAMBA_VERSION=$(( ((major + 1) << 16) | minor )) printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \ "$test_node" \ "$CTDB_TEST_SAMBA_VERSION" -restart_ctdb_1 "$test_node" +ctdb_nodes_restart "$test_node" echo "Will use PID file ${pidfile} to check for ctdbd exit" wait_until 30 ! test -f "$pidfile" echo "GOOD: ctdbd exited early on node ${test_node}" @@ -56,7 +56,7 @@ export CTDB_TEST_SAMBA_VERSION=$(( (major << 16) | (minor + 1) )) printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \ "$test_node" \ "$CTDB_TEST_SAMBA_VERSION" -start_ctdb_1 "$test_node" +ctdb_nodes_start "$test_node" echo "Will use PID file ${pidfile} to check for ctdbd exit" wait_until 30 ! test -f "$pidfile" echo "GOOD: ctdbd exited early on node ${test_node}" diff --git a/ctdb/tests/local_daemons.sh b/ctdb/tests/local_daemons.sh index e9f9423cb0c..a67055a9337 100755 --- a/ctdb/tests/local_daemons.sh +++ b/ctdb/tests/local_daemons.sh @@ -367,7 +367,10 @@ local_daemons_stop () onnode_common - onnode -p "$_nodes" "${CTDB:-${VALGRIND:-} ctdb} shutdown" + onnode -p "$_nodes" \ + "if [ -e \"\${CTDB_BASE}/run/ctdbd.pid\" ] ; then \ + ${CTDB:-${VALGRIND:-} ctdb} shutdown ; \ + fi" } local_daemons_onnode_usage () diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash index 51e9c7cb822..31f4387a404 100644 --- a/ctdb/tests/scripts/integration.bash +++ b/ctdb/tests/scripts/integration.bash @@ -50,7 +50,7 @@ ctdb_test_exit () unset ctdb_test_exit_hook echo "Stopping cluster..." - ctdb_stop_all + ctdb_nodes_stop || ctdb_test_error "Cluster shutdown failed" exit $status } @@ -92,13 +92,13 @@ ctdb_test_init () { trap "ctdb_test_exit" 0 - ctdb_stop_all >/dev/null 2>&1 || true + ctdb_nodes_stop >/dev/null 2>&1 || true echo "Configuring cluster..." - setup_ctdb "$@" || exit 1 + setup_ctdb "$@" || ctdb_test_error "Cluster configuration failed" echo "Starting cluster..." - ctdb_init || exit 1 + ctdb_init || ctdb_test_error "Cluster startup failed" echo "*** SETUP COMPLETE AT $(date '+%F %T'), RUNNING TEST..." } @@ -111,6 +111,13 @@ ctdb_test_skip_on_cluster () fi } + +ctdb_nodes_restart () +{ + ctdb_nodes_stop "$@" + ctdb_nodes_start "$@" +} + ######################################## # Sets: $out, $outfile @@ -568,9 +575,9 @@ wait_until_node_has_no_ips () ctdb_init () { - ctdb_stop_all >/dev/null 2>&1 || : + ctdb_nodes_stop >/dev/null 2>&1 || : - ctdb_start_all || ctdb_test_error "Cluster start failed" + ctdb_nodes_start || ctdb_test_error "Cluster start failed" wait_until_ready || ctdb_test_error "Cluster didn't become ready" diff --git a/ctdb/tests/scripts/integration_local_daemons.bash b/ctdb/tests/scripts/integration_local_daemons.bash index 9850ad2208c..643fc5ef846 100644 --- a/ctdb/tests/scripts/integration_local_daemons.bash +++ b/ctdb/tests/scripts/integration_local_daemons.bash @@ -45,39 +45,42 @@ setup_ctdb () fi } -start_ctdb_1 () +ctdb_nodes_start () { - local pnn="$1" + local nodespec="${1:-all}" - $ctdb_local_daemons start "$pnn" + $ctdb_local_daemons start "$nodespec" } -ctdb_start_all () +ctdb_nodes_stop () { - $ctdb_local_daemons start "all" -} + local nodespec="${1:-all}" -stop_ctdb_1 () -{ - local pnn="$1" + if $ctdb_local_daemons stop "$nodespec" ; then + return 0 + fi - $ctdb_local_daemons stop "$pnn" -} + # Failed, dump logs? + if $CTDB_TEST_PRINT_LOGS_ON_ERROR ; then + _print_logs + fi -ctdb_stop_all () -{ - $ctdb_local_daemons stop "all" + # Next level up can log the error... + return 1 } -restart_ctdb_1 () +onnode () { - stop_ctdb_1 "$1" - start_ctdb_1 "$1" + $ctdb_local_daemons onnode "$@" } -onnode () + + +_print_logs () { - $ctdb_local_daemons onnode "$@" + echo "*** LOG START --------------------" + $ctdb_local_daemons print-log all | tail -n 500 + echo "*** LOG END --------------------" } _print_logs_on_test_failure () @@ -88,7 +91,5 @@ _print_logs_on_test_failure () return fi - echo "*** LOG START --------------------" - $ctdb_local_daemons print-log all | tail -n 500 - echo "*** LOG END --------------------" + _print_logs } diff --git a/ctdb/tests/scripts/integration_real_cluster.bash b/ctdb/tests/scripts/integration_real_cluster.bash index 455f1431b98..8d3f68a0b2c 100644 --- a/ctdb/tests/scripts/integration_real_cluster.bash +++ b/ctdb/tests/scripts/integration_real_cluster.bash @@ -39,26 +39,15 @@ _service_ctdb () } # Stop/start CTDB on all nodes. Override for local daemons. -ctdb_stop_all () +ctdb_nodes_stop () { - onnode -p all "$CTDB_TEST_WRAPPER" _service_ctdb stop -} -ctdb_start_all () -{ - onnode -p all "$CTDB_TEST_WRAPPER" _service_ctdb start -} + local nodespec="${1:-all}" -start_ctdb_1 () -{ - onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb start + onnode -p "$nodespec" "$CTDB_TEST_WRAPPER" _service_ctdb stop } - -stop_ctdb_1 () +ctdb_nodes_start () { - onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb stop -} + local nodespec="${1:-all}" -restart_ctdb_1 () -{ - onnode "$1" "$CTDB_TEST_WRAPPER" _service_ctdb restart + onnode -p "$nodespec" "$CTDB_TEST_WRAPPER" _service_ctdb start } -- Samba Shared Repository