ctdb:tests:76_ctdb_pdb_recovery: fix a typo in a message
[Samba/wip.git] / ctdb / tests / simple / 76_ctdb_pdb_recovery.sh
blob959ef7da9bfd99985cc8df866ea5a7f4bf03c5d7
1 #!/bin/bash
3 test_info()
5 cat <<EOF
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.
12 Steps:
14 1. Create a persistent database
15 2. Add a record and update it few times.
16 3. Delete the record
17 4. Turn off one of the nodes
18 5. Add a record with same key.
19 6. Turn on the stopped node
21 Expected results:
23 * Check that the record is deleted (RSN based recovery) and record is
24 present (sequence number based recovery)
26 EOF
29 . "${TEST_SCRIPTS_DIR}/integration.bash"
31 ctdb_test_init "$@"
33 set -e
35 cluster_is_healthy
37 # Reset configuration
38 ctdb_restart_when_done
40 do_test()
42 # Wipe Test database
43 echo "wipe test database"
44 try_command_on_node 0 $CTDB wipedb $TESTDB
46 # Add a record key=test1 data=value1
47 # and update values
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
52 done
54 # Delete record
55 echo "delete key(test1)"
56 try_command_on_node 0 $CTDB pdelete $TESTDB test1
58 # Stop a node
59 echo "stop node 1"
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
69 # Continue node
70 echo "contine node 1"
71 try_command_on_node 1 $CTDB continue
73 wait_until_node_has_status 1 notstopped
78 # Main test
80 TESTDB="persistent_test.tdb"
82 status=0
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
91 do_test
92 if try_command_on_node 0 $CTDB pfetch $TESTDB test1 ; then
93 echo "GOOD: Record was not deleted (recovery by RSN worked)"
94 else
95 echo "BAD: Record was deleted"
96 status=1
99 # Set RecoverPDBBySeqNum = 1
100 echo "set RecoverPDBBySeqNum to 1"
101 try_command_on_node all $CTDB setvar RecoverPDBBySeqNum 1
103 do_test
104 if try_command_on_node 0 $CTDB pfetch $TESTDB test1 ; then
105 echo "GOOD: Record was not deleted (recovery by sequence number worked)"
106 else
107 echo "BAD: Record was deleted"
108 status=1
111 exit $status