| 1 |
# |
| 2 |
# Execute parent query on node_1 and wait for it to reach node_2 |
| 3 |
# |
| 4 |
--connection node_2 |
| 5 |
SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; |
| 6 |
|
| 7 |
--connection node_1 |
| 8 |
--eval $fk_parent_query |
| 9 |
|
| 10 |
--connection node_2 |
| 11 |
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; |
| 12 |
|
| 13 |
SET SESSION wsrep_sync_wait = 0; |
| 14 |
--let $expected_apply_waits = query_get_value("SHOW STATUS LIKE 'wsrep_apply_waits'", Value, 1) |
| 15 |
--let $expected_apply_waits = `select $expected_apply_waits + 1` |
| 16 |
|
| 17 |
|
| 18 |
# |
| 19 |
# Execute child query on node_1. |
| 20 |
# If bug is present, expect the wait condition |
| 21 |
# to timeout and when the child query applies, it |
| 22 |
# will be granted a MDL lock on parent table. |
| 23 |
# When resumed, the parent query will |
| 24 |
# also try to acquire MDL lock on parent table, |
| 25 |
# causing a BF-BF conflict on that MDL lock. |
| 26 |
# |
| 27 |
--connection node_1 |
| 28 |
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; |
| 29 |
START TRANSACTION; |
| 30 |
--eval $fk_child_query |
| 31 |
--let $wait_condition = SELECT COUNT(*) = $fk_mdl_lock_num FROM performance_schema.metadata_locks WHERE OBJECT_SCHEMA='test' AND LOCK_STATUS="GRANTED" |
| 32 |
--source include/wait_condition.inc |
| 33 |
COMMIT; |
| 34 |
|
| 35 |
|
| 36 |
# |
| 37 |
# Expect the child query to depend on the parent query, |
| 38 |
# therefore it should wait for the parent query to |
| 39 |
# finish before it can be applied. |
| 40 |
# |
| 41 |
--connection node_2 |
| 42 |
--let $status_var = wsrep_apply_waits |
| 43 |
--let $status_var_value = $expected_apply_waits |
| 44 |
--source include/wait_for_status_var.inc |
| 45 |
|
| 46 |
SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; |
| 47 |
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; |
| 48 |
|
| 49 |
|
| 50 |
# |
| 51 |
# Cleanup |
| 52 |
# |
| 53 |
SET DEBUG_SYNC = 'RESET'; |
| 54 |
SET GLOBAL DEBUG_DBUG = ""; |
| 55 |
SET GLOBAL wsrep_slave_threads=DEFAULT; |
| 56 |
|
| 57 |
--connection node_1 |
| 58 |
SET DEBUG_SYNC = 'RESET'; |
| 59 |
SET GLOBAL DEBUG_DBUG = ""; |
| 60 |
SET GLOBAL wsrep_slave_threads=DEFAULT; |