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 echo "\"test1\" \"$value\"" | try_command_on_node
-i 0 $CTDB ptrans
"$TESTDB"
54 echo "delete key(test1)"
55 try_command_on_node
0 $CTDB pdelete
$TESTDB test1
59 try_command_on_node
1 $CTDB stop
61 wait_until_node_has_status
1 stopped
63 # Add a record key=test1 data=value2
64 echo "store key(test1) data(newvalue1)"
65 echo '"test1" "newvalue1"' | try_command_on_node
-i 0 $CTDB ptrans
"$TESTDB"
69 try_command_on_node
1 $CTDB continue
71 wait_until_node_has_status
1 notstopped
78 TESTDB
="persistent_test.tdb"
82 # Create a temporary persistent database to test with
83 echo "create persistent test database $TESTDB"
84 try_command_on_node
0 $CTDB attach
$TESTDB persistent
86 echo "set RecoverPDBBySeqNum to 0"
87 try_command_on_node all
$CTDB setvar RecoverPDBBySeqNum
0
90 if try_command_on_node
0 $CTDB pfetch
$TESTDB test1
; then
91 echo "GOOD: Record was not deleted (recovery by RSN worked)"
93 echo "BAD: Record was deleted"
97 # Set RecoverPDBBySeqNum = 1
98 echo "set RecoverPDBBySeqNum to 1"
99 try_command_on_node all
$CTDB setvar RecoverPDBBySeqNum
1
102 if try_command_on_node
0 $CTDB pfetch
$TESTDB test1
; then
103 echo "GOOD: Record was not deleted (recovery by sequence number worked)"
105 echo "BAD: Record was deleted"