| 1 |
# |
| 2 |
# Verify that transaction which has reached group commit queue |
| 3 |
# cannot be killed. If the kill succeeds, assertion for |
| 4 |
# wsrep transaction state will fail. |
| 5 |
# |
| 6 |
# If the bug is present, i.e. wsrep transaction gets killed during |
| 7 |
# group commit wait, this test is enough to reproduce the crash |
| 8 |
# most of the time. |
| 9 |
# |
| 10 |
|
| 11 |
--source include/have_innodb.inc |
| 12 |
--source include/have_debug_sync.inc |
| 13 |
--source include/galera_cluster.inc |
| 14 |
|
| 15 |
# Connection for KILL commands |
| 16 |
--connect node_1_kill, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 17 |
# Connection for sync point control |
| 18 |
--connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 19 |
SET SESSION wsrep_sync_wait = 0; |
| 20 |
# Connection for group commit follower |
| 21 |
--connect node_1_follower, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 22 |
# Need to disable sync wait to reach commit queue when leader |
| 23 |
# is blocked. |
| 24 |
SET SESSION wsrep_sync_wait = 0; |
| 25 |
--let $follower_id = `SELECT CONNECTION_ID()` |
| 26 |
|
| 27 |
--connection node_1 |
| 28 |
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; |
| 29 |
|
| 30 |
SET SESSION DEBUG_SYNC = "commit_before_enqueue SIGNAL leader_before_enqueue_reached WAIT_FOR leader_before_enqueue_continue"; |
| 31 |
--send INSERT INTO t1 VALUES (1) |
| 32 |
|
| 33 |
--connection node_1_ctrl |
| 34 |
SET DEBUG_SYNC = "now WAIT_FOR leader_before_enqueue_reached"; |
| 35 |
|
| 36 |
--connection node_1_follower |
| 37 |
# SET SESSION DEBUG_SYNC = "group_commit_waiting_for_prior SIGNAL follower_waiting_for_prior_reached WAIT_FOR follower_waiting_for_prior_continue"; |
| 38 |
--send INSERT INTO t1 VALUES (2); |
| 39 |
|
| 40 |
--connection node_1_ctrl |
| 41 |
# TODO: Is it possible to use sync points to enforce group commit to happen? |
| 42 |
# The leader will hold commit monitor in commit_before_enqueue sync point, |
| 43 |
# which prevents the follower to reach the group commit wait state. |
| 44 |
# We now sleep and expect the follower to reach group commit, but this |
| 45 |
# may cause false negatives. |
| 46 |
--sleep 1 |
| 47 |
|
| 48 |
--connection node_1_kill |
| 49 |
--echo # Execute KILL QUERY for group commit follower |
| 50 |
--disable_query_log |
| 51 |
--disable_result_log |
| 52 |
# Because it is currently impossible to verify that the |
| 53 |
# follower has reached group commit queue, the KILL may |
| 54 |
# sometimes return success. |
| 55 |
--error 0,ER_KILL_DENIED_ERROR |
| 56 |
--eval KILL QUERY $follower_id |
| 57 |
--enable_result_log |
| 58 |
--enable_query_log |
| 59 |
|
| 60 |
SET DEBUG_SYNC = "now SIGNAL leader_before_enqueue_continue"; |
| 61 |
--connection node_1_follower |
| 62 |
--reap |
| 63 |
|
| 64 |
--connection node_1 |
| 65 |
--reap |
| 66 |
SELECT * FROM t1; |
| 67 |
|
| 68 |
SET DEBUG_SYNC = "RESET"; |
| 69 |
DROP TABLE t1; |