6 The command 'ctdb wipedb' is used to clear a database across the whole
11 * An active CTDB cluster with at least 2 active nodes.
15 1. Verify that the status on all of the ctdb nodes is 'OK'.
16 2. create a persistent test database
17 3, add some records to node #0 and node #1
18 4, perform wipedb on node #0 and verify the database is empty on both node 0 and 1
22 * that 4 will result in empty database
27 . "${TEST_SCRIPTS_DIR}/integration.bash"
35 try_command_on_node 0 "$CTDB listnodes"
36 num_nodes=$(echo "$out" | wc -l)
38 # create a temporary persistent database to test with
39 echo create persistent test database persistent_test.tdb
40 try_command_on_node 0 $CTDB_TEST_WRAPPER ctdb attach persistent_test.tdb persistent
44 # add one record to node 0 key==ABC data==ABC
45 TDB=`try_command_on_node -v 0 $CTDB_TEST_WRAPPER ctdb getdbmap | grep persistent_test.tdb | sed -e "s/.*path://" -e "s/ .*//"`
46 echo "store key(ABC) data(ABC) on node 0"
47 try_command_on_node 0 $CTDB_TEST_WRAPPER ctdb tstore $TDB 0x414243 0x070000000000000000000000000000000000000000000000414243
49 # add one record to node 1 key==DEF data==DEF
50 TDB=`try_command_on_node -v 1 $CTDB_TEST_WRAPPER ctdb getdbmap | grep persistent_test.tdb | sed -e "s/.*path://" -e "s/ .*//"`
51 echo "store key(DEF) data(DEF) on node 1"
52 try_command_on_node 1 $CTDB_TEST_WRAPPER ctdb tstore $TDB 0x444546 0x070000000000000000000000000000000000000000000000444546
56 echo wipe the persistent test database
57 try_command_on_node 0 $CTDB_TEST_WRAPPER ctdb wipedb persistent_test.tdb
59 try_command_on_node 0 $CTDB_TEST_WRAPPER ctdb recover
61 # check that the database is wiped
62 num_records=$(try_command_on_node -v 1 $CTDB_TEST_WRAPPER ctdb cattdb persistent_test.tdb | grep key | wc -l)
63 [ $num_records != "0" ] && {
64 echo "BAD: we did not end up with an empty database"
67 echo "OK. database was wiped"