6 The recovery process based on RSN for persistent databases is defective.
7 For persistent databases sequence number based recovery method should be
8 used. This test checks for the defect in the RSN based recovery method
9 for persistent databases and confirms that the same issue is not observed
10 when using sequence number based recovery method.
14 1. Create a persistent database
15 2. Add a record and update it few times.
17 4. Turn off one of the nodes
18 5. Add a record with same key.
19 6. Turn on the stopped node
23 * Check that the record is deleted (RSN based recovery) and record is
24 present (sequence number based recovery)
29 .
"${TEST_SCRIPTS_DIR}/integration.bash"
38 ctdb_restart_when_done
43 echo "wipe test database"
44 try_command_on_node
0 $CTDB wipedb
$TESTDB
46 # Add a record key=test1 data=value1
48 for value
in value1 value2 value3 value4 value5
; do
49 echo "store key(test1) data($value)"
50 try_command_on_node
0 "(echo -ne $value > /tmp/test_data)"
51 try_command_on_node
0 $CTDB pstore
$TESTDB test1
/tmp
/test_data
55 echo "delete key(test1)"
56 try_command_on_node
0 $CTDB pdelete
$TESTDB test1
60 try_command_on_node
1 $CTDB stop
62 wait_until_node_has_status
1 stopped
64 # Add a record key=test1 data=value2
65 echo "store key(test1) data(newvalue1)"
66 try_command_on_node
0 "(echo -ne newvalue1 > /tmp/test_data)"
67 try_command_on_node
0 $CTDB pstore
$TESTDB test1
/tmp
/test_data
71 try_command_on_node
1 $CTDB continue
73 wait_until_node_has_status
1 notstopped
80 TESTDB
="persistent_test.tdb"
84 # Create a temporary persistent database to test with
85 echo "create persistent test database $TESTDB"
86 try_command_on_node
0 $CTDB attach
$TESTDB persistent
88 echo "set RecoverPDBBySeqNum to 0"
89 try_command_on_node all
$CTDB setvar RecoverPDBBySeqNum
0
92 if try_command_on_node
0 $CTDB pfetch
$TESTDB test1
; then
93 echo "GOOD: Record was not deleted (recovery by RSN worked)"
95 echo "BAD: Record was deleted"
99 # Set RecoverPDBBySeqNum = 1
100 echo "set RecoverPDBBySeqNum to 1"
101 try_command_on_node all
$CTDB setvar RecoverPDBBySeqNum
1
104 if try_command_on_node
0 $CTDB pfetch
$TESTDB test1
; then
105 echo "GOOD: Record was not deleted (recovery by sequence number worked)"
107 echo "BAD: Record was deleted"