3 # Confirm that a record is not vacuumed if it is locked on the
4 # deleting node when the 3rd fast vacuuming run occurs, but is dropped
5 # from the lmaster delete list
7 . "${TEST_SCRIPTS_DIR}/integration.bash"
16 echo "Stall vacuuming on all nodes"
17 ctdb_onnode -p all "setvar VacuumInterval 99999"
20 echo "Getting list of nodes..."
23 # all_pnns is set above by ctdb_get_all_pnns()
24 # shellcheck disable=SC2154
25 first=$(echo "$all_pnns" | sed -n -e '1p')
28 echo "Determine lmaster node for key"
29 testprog_onnode "$first" "ctdb-db-test get-lmaster key"
30 # $out is set above by testprog_onnode()
31 # shellcheck disable=SC2154
33 echo "lmaster=${lmaster}"
36 # Find a non-lmaster node
37 for i in $all_pnns ; do
38 if [ "$i" != "$lmaster" ] ; then
43 if [ -z "$non_lmaster" ] ; then
44 ctdb_test_fail "Could not find non-lmaster node for key"
47 echo "............................................................"
48 echo "Delete key ${key} on node ${non_lmaster}"
49 echo "Lock on non-lmaster node ${non_lmaster} during 3rd vacuuming run"
50 echo "............................................................"
54 echo "Create/wipe test database ${db}"
55 ctdb_onnode "$first" "attach ${db}"
56 ctdb_onnode "$first" "wipedb ${db}"
58 echo "Create a record in ${db}"
59 ctdb_onnode "$first" "writekey ${db} ${key} value1"
61 echo "Migrate record to all nodes"
62 ctdb_onnode all "readkey ${db} ${key}"
64 echo "Confirm that all nodes have the record"
65 check_cattdb_num_records "$db" 1 "$all_pnns"
69 echo "Delete key \"${key}\" from node ${non_lmaster}"
70 ctdb_onnode "$non_lmaster" "deletekey $db ${key}"
73 echo "Do a fast vacuuming run on node ${non_lmaster}"
74 testprog_onnode "$non_lmaster" "ctdb-db-test vacuum ${db}"
77 echo "Confirm that all nodes still have the record"
78 check_cattdb_num_records "$db" 1 "$all_pnns"
81 echo "Do a fast vacuuming run on lmaster node ${lmaster}"
82 testprog_onnode "$lmaster" "ctdb-db-test vacuum ${db}"
85 echo "Confirm that all nodes still have the record"
86 check_cattdb_num_records "$db" 1 "$all_pnns"
89 echo "Lock record on non-lmaster node ${non_lmaster}"
90 testprog_onnode "$non_lmaster" "ctdb-db-test local-lock ${db} ${key}"
92 ctdb_test_cleanup_pid_set "$non_lmaster" "$pid"
94 echo "Do a fast vacuuming run on node ${lmaster}"
95 testprog_onnode "$lmaster" "ctdb-db-test vacuum ${db}"
97 echo "Kill lock process ${pid} on node ${non_lmaster}"
98 try_command_on_node "$non_lmaster" "kill ${pid}"
99 ctdb_test_cleanup_pid_clear
102 echo "Confirm that nodes ${lmaster} and ${non_lmaster} still have the record"
103 check_cattdb_num_records "$db" 1 "${lmaster} ${non_lmaster}"
105 vacuum_confirm_key_empty_dmaster "$lmaster" "$db" "$key"
109 # Record has been dropped from the delete list so this will not pick it up
110 echo "Do a fast vacuuming run on lmaster node ${lmaster}"
111 testprog_onnode "$lmaster" "ctdb-db-test vacuum ${db}"
114 echo "Confirm that nodes ${lmaster} and ${non_lmaster} still have the record"
115 check_cattdb_num_records "$db" 1 "${lmaster} ${non_lmaster}"
117 vacuum_confirm_key_empty_dmaster "$lmaster" "$db" "$key"