From 7e1cdac0ab90eeef70faa80dc8e7f9e3bd9effd9 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 6 Jul 2009 16:40:31 +1000 Subject: [PATCH] Make ctdbd restarts in tests more reliable. This works around potential race conditions in the init script where the restart operation is not necessarily reliable. It just wraps the actual restart in a loop and tries for a successful restart up to 5 times. Signed-off-by: Martin Schwenke (This used to be ctdb commit 3f7a4afa0fcc5825beb89267973939df8cde4999) --- ctdb/tests/scripts/ctdb_test_functions.bash | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ctdb/tests/scripts/ctdb_test_functions.bash b/ctdb/tests/scripts/ctdb_test_functions.bash index c7aaf6a9c8a..396c848034d 100644 --- a/ctdb/tests/scripts/ctdb_test_functions.bash +++ b/ctdb/tests/scripts/ctdb_test_functions.bash @@ -672,12 +672,18 @@ restart_ctdb () fi echo "..." - if [ -n "$CTDB_NODES_SOCKETS" ] ; then - daemons_stop - daemons_start $CTDB_TEST_NUM_DAEMONS - else - onnode -pq all $CTDB_TEST_WRAPPER _restart_ctdb - fi || return 1 + local i + for i in $(seq 1 5) ; do + if [ -n "$CTDB_NODES_SOCKETS" ] ; then + daemons_stop + daemons_start $CTDB_TEST_NUM_DAEMONS + else + onnode -p all $CTDB_TEST_WRAPPER _restart_ctdb + fi && break + + echo "That didn't seem to work - sleeping a while and trying again..." + sleep_for 5 + done onnode -q 1 $CTDB_TEST_WRAPPER wait_until_healthy || return 1