mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
8b24cae630
* Use "#!/usr/bin/env bash" for improved portability * Drop test_info() definition and replace it with a comment The use of test_info() is pointless. * Drop call to cluster_is_healthy() This is a holdover from when the previous test would restart daemons to get things ready for a test. There was also a bug where going into recovery during the restart would sometimes cause the cluster to become unhealthy. If we really need something like this then we can add it to ctdb_test_init(). * Make order of preamble consistent Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
64 lines
1.5 KiB
Bash
Executable File
64 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Ensure recovery doesn't resurrect deleted records from recently
|
|
# inactive nodes
|
|
|
|
. "${TEST_SCRIPTS_DIR}/integration.bash"
|
|
|
|
set -e
|
|
|
|
ctdb_test_init
|
|
|
|
testdb="rec_test.tdb"
|
|
|
|
echo "Getting list of nodes..."
|
|
ctdb_get_all_pnns
|
|
|
|
first=$(echo "$all_pnns" | sed -n -e '1p')
|
|
second=$(echo "$all_pnns" | sed -n -e '2p')
|
|
notfirst=$(echo "$all_pnns" | tail -n +2)
|
|
|
|
echo "Create/wipe test database ${testdb}"
|
|
try_command_on_node $first $CTDB attach "$testdb"
|
|
try_command_on_node $first $CTDB wipedb "$testdb"
|
|
|
|
echo "store key(test1) data(value1)"
|
|
try_command_on_node $first $CTDB writekey "$testdb" test1 value1
|
|
|
|
echo "Migrate key(test1) to all nodes"
|
|
try_command_on_node all $CTDB readkey "$testdb" test1
|
|
|
|
echo "Stop node ${first}"
|
|
try_command_on_node $first $CTDB stop
|
|
wait_until_node_has_status $first stopped
|
|
|
|
echo "Delete key(test1)"
|
|
try_command_on_node $second $CTDB deletekey "$testdb" test1
|
|
|
|
database_has_zero_records ()
|
|
{
|
|
# shellcheck disable=SC2086
|
|
# $notfirst can be multi-word
|
|
check_cattdb_num_records "$testdb" 0 "$notfirst"
|
|
}
|
|
|
|
echo "Trigger a recovery"
|
|
try_command_on_node "$second" $CTDB recover
|
|
|
|
echo "Checking that database has 0 records"
|
|
database_has_zero_records
|
|
|
|
echo "Continue node ${first}"
|
|
try_command_on_node $first $CTDB continue
|
|
wait_until_node_has_status $first notstopped
|
|
|
|
echo "Get database contents"
|
|
try_command_on_node -v $first $CTDB catdb "$testdb"
|
|
|
|
if grep -q '^key(' "$outfile" ; then
|
|
echo "BAD: Deleted record has been resurrected"
|
|
exit 1
|
|
fi
|
|
|
|
echo "GOOD: Deleted record is still gone"
|