6 Ensure recovery doesn't resurrect deleted records from recently inactive nodes
10 . "${TEST_SCRIPTS_DIR}/integration.bash"
20 echo "Getting list of nodes..."
21 try_command_on_node -v any "onnode -pq all ctdb pnn | grep '^[0-9][0-9]*$'"
23 first=$(echo "$out" | sed -n -e '1p')
24 second=$(echo "$out" | sed -n -e '2p')
25 notfirst=$(echo "$out" | tail -n +2)
27 echo "Create/wipe test database ${testdb}"
28 try_command_on_node $first $CTDB attach "$testdb"
29 try_command_on_node $first $CTDB wipedb "$testdb"
31 echo "store key(test1) data(value1)"
32 try_command_on_node $first $CTDB writekey "$testdb" test1 value1
34 echo "Migrate key(test1) to all nodes"
35 try_command_on_node all $CTDB readkey "$testdb" test1
37 echo "Stop node ${first}"
38 try_command_on_node $first $CTDB stop
39 wait_until_node_has_status $first stopped
41 echo "Delete key(test1)"
42 try_command_on_node $second $CTDB deletekey "$testdb" test1
44 database_has_zero_records ()
47 for n in $notfirst ; do
48 try_command_on_node $n $CTDB cattdb "$testdb"
49 if echo "$out" | grep -q '^key(' ; then
57 echo "Get vacuum interval"
58 try_command_on_node -v $second $CTDB getvar VacuumInterval
59 vacuum_interval="${out#* = }"
61 echo "Wait until vacuuming deletes the record on active nodes"
63 # 1. Original node processes delete queue, asks lmaster to fetch
64 # 2. lmaster recoverd fetches
65 # 3. lmaster processes delete queue
66 # If vacuuming is just missed then need an extra interval
67 t=$((vacuum_interval * 4))
68 wait_until "${t}/10" database_has_zero_records
70 echo "Continue node ${first}"
71 try_command_on_node $first $CTDB continue
72 wait_until_node_has_status $first notstopped
74 echo "Get database contents"
75 try_command_on_node -v $first $CTDB catdb "$testdb"
77 if echo "$out" | grep -q '^key(' ; then
78 echo "BAD: Deleted record has been resurrected"
82 echo "GOOD: Deleted record is still gone"