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 * An empty database will result
27 .
"${TEST_SCRIPTS_DIR}/integration.bash"
35 try_command_on_node
0 "$CTDB listnodes"
36 num_nodes
=$
(echo "$out" |
wc -l)
39 test_db
="persistent_test.tdb"
40 echo "Create persistent test database \"$test_db\""
41 try_command_on_node
0 $CTDB attach
"$test_db" persistent
44 # add one record to node 0 key==ABC data==ABC
45 echo "Store key(ABC) data(ABC) on node 0"
46 db_ctdb_tstore
0 "$test_db" "ABC" "ABC"
48 # add one record to node 1 key==DEF data==DEF
49 echo "Store key(DEF) data(DEF) on node 1"
50 db_ctdb_tstore
1 "$test_db" "DEF" "DEF"
54 try_command_on_node
0 $CTDB wipedb
"$test_db"
56 # check that the database is wiped
57 num_records
=$
(db_ctdb_cattdb_count_records
1 "$test_db")
58 if [ $num_records = "0" ] ; then
59 echo "OK: Database was wiped"
61 echo "BAD: We did not end up with an empty database"
65 echo "Force a recovery"
66 try_command_on_node
0 $CTDB recover
68 # check that the database is wiped
69 num_records
=$
(db_ctdb_cattdb_count_records
1 "$test_db")
70 if [ $num_records = "0" ] ; then
71 echo "OK: Database was wiped"
73 echo "BAD: We did not end up with an empty database"