export CTDB_TEST_MODE="yes"
# Following 2 lines may be modified by installation script
-export CTDB_TESTS_ARE_INSTALLED=false
-export CTDB_TEST_DIR=$(dirname "$0")
+CTDB_TESTS_ARE_INSTALLED=false
+CTDB_TEST_DIR=$(dirname "$0")
+export CTDB_TESTS_ARE_INSTALLED CTDB_TEST_DIR
export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts"
. "${TEST_SCRIPTS_DIR}/common.sh"
-# common.sh will set TEST_SUBDIR to a stupid value when installed
-# because common.sh is usually sourced by a test. TEST_SUBDIR needs
-# to be correctly set so setup_ctdb_base() finds the etc-ctdb/
-# subdirectory and the test event script is correctly installed, so
-# fix it.
-TEST_SUBDIR="$CTDB_TEST_DIR"
-
if ! $CTDB_TESTS_ARE_INSTALLED ; then
hdir="$CTDB_SCRIPTS_HELPER_BINDIR"
export CTDB_EVENTD="${hdir}/ctdb-eventd"
ln -s "$_socket_wrapper_so" "$_so"
_d="${directory}/sw"
+ rm -rf "$_d"
mkdir -p "$_d"
}
-n <num> Number of nodes (default: 3)
-P <file> Public addresses file (default: automatically generated)
-R Use a command for the recovery lock (default: use a file)
+ -r <time> Like -R and set recheck interval to <time> (default: use a file)
-S <library> Socket wrapper shared library to preload (default: none)
-6 Generate IPv6 IPs for nodes, public addresses (default: IPv4)
EOF
_num_nodes=3
_public_addresses_file=""
_recovery_lock_use_command=false
+ _recovery_lock_recheck_interval=""
_socket_wrapper=""
_use_ipv6=false
set -e
- while getopts "FN:n:P:RS:6h?" _opt ; do
+ while getopts "FN:n:P:Rr:S:6h?" _opt ; do
case "$_opt" in
F) _disable_failover=true ;;
N) _nodes_file="$OPTARG" ;;
n) _num_nodes="$OPTARG" ;;
P) _public_addresses_file="$OPTARG" ;;
R) _recovery_lock_use_command=true ;;
+ r) _recovery_lock_use_command=true
+ _recovery_lock_recheck_interval="$OPTARG"
+ ;;
S) _socket_wrapper="$OPTARG" ;;
6) _use_ipv6=true ;;
\?|h) local_daemons_setup_usage ;;
_recovery_lock="${directory}/rec.lock"
if $_recovery_lock_use_command ; then
_helper="${CTDB_SCRIPTS_HELPER_BINDIR}/ctdb_mutex_fcntl_helper"
- _recovery_lock="! ${_helper} ${_recovery_lock}"
+ _t="! ${_helper} ${_recovery_lock}"
+ if [ -n "$_recovery_lock_recheck_interval" ] ; then
+ _t="${_t} ${_recovery_lock_recheck_interval}"
+ fi
+ _recovery_lock="$_t"
fi
if [ -n "$_socket_wrapper" ] ; then
fi
for _n in $(seq 0 $((_num_nodes - 1))) ; do
- setup_ctdb_base "$directory" "node.${_n}" \
+ # CTDB_TEST_SUITE_DIR needs to be correctly set so
+ # setup_ctdb_base() finds the etc-ctdb/ subdirectory
+ # and the test event script is correctly installed
+ # shellcheck disable=SC2034
+ CTDB_TEST_SUITE_DIR="$CTDB_TEST_DIR" \
+ setup_ctdb_base "$directory" "node.${_n}" \
functions notify.sh debug-hung-script.sh
cp "$_nodes_all" "${CTDB_BASE}/nodes"
onnode_common
- onnode -p "$_nodes" "${VALGRIND:-} ${CTDB:-ctdb} shutdown"
+ onnode -p "$_nodes" "${CTDB:-${VALGRIND:-} ctdb} shutdown"
}
local_daemons_onnode_usage ()
onnode -q "$_nodes" "${VALGRIND:-} ${_path} socket ctdbd"
}
-local_daemons_dump_logs ()
+local_daemons_print_log ()
{
if [ $# -ne 1 ] || [ "$1" = "-h" ] ; then
- local_daemons_generic_usage "dump-logs"
+ local_daemons_generic_usage "print-log"
fi
_nodes="$1"
stop Stop specified daemon(s)
onnode Run a command in the environment of specified daemon(s)
print-socket Print the Unix domain socket used by specified daemon(s)
- dump-logs Dump logs for specified daemon(s) to stdout
+ print-log Print logs for specified daemon(s) to stdout
All commands use <directory> for daemon configuration
stop) local_daemons_stop "$@" ;;
onnode) local_daemons_onnode "$@" ;;
print-socket) local_daemons_print_socket "$@" ;;
-dump-logs) local_daemons_dump_logs "$@" ;;
+print-log) local_daemons_print_log "$@" ;;
*) usage ;;
esac