Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_foreign_key_mdl.inc

raw
1 # set slave_exec_mode.
2 connection slave;
3 set @saved_dbug = @@global.debug_dbug;
4 set @saved_exec_mode= @@global.slave_exec_mode;
5
6 # set debug sync point to block parent query on slave.
7 set @@global.debug_dbug= "+d,rows_log_event_after_open_table";
8
9 --source include/stop_slave.inc
10 --eval set global slave_exec_mode='$fk_slave_exec_mode'
11 --source include/start_slave.inc
12
13 --echo # INSERT on master so it is replicated to slave (where its execution will be blocked after taking locks)
14 connection master;
15 INSERT INTO t1 (f2) VALUES (0);
16
17 --connection slave
18 set debug_sync='now WAIT_FOR after_open_table';
19
20 --echo # test.t1 should always be locked with SHARED_WRITE
21 --let $wait_condition = SELECT COUNT(*)=1 FROM performance_schema.metadata_locks WHERE OBJECT_SCHEMA='test' AND OBJECT_NAME='t1' AND LOCK_STATUS='GRANTED' AND LOCK_TYPE='SHARED_WRITE'
22 --source include/wait_condition.inc
23
24 --let $t2_lock_type= SHARED_READ
25 if (`SELECT strcmp("$fk_slave_exec_mode", "IDEMPOTENT") = 0`)
26 {
27 --let $t2_lock_type= SHARED_WRITE
28 }
29
30 --echo # test.t2 lock type should be SHARED_WRITE only when slave_exec_mode is IDEMPOTENT. Current mode: $fk_slave_exec_mode
31 --let $wait_condition = SELECT COUNT(*)=1 FROM performance_schema.metadata_locks WHERE OBJECT_SCHEMA='test' AND OBJECT_NAME='t2' AND LOCK_STATUS='GRANTED' AND LOCK_TYPE='$t2_lock_type'
32 --source include/wait_condition.inc
33
34 # Cleanup
35 connection slave;
36 SET DEBUG_SYNC= 'RESET';
37 set debug_sync='now SIGNAL continue_rows_ev';
38 SET @@GLOBAL.debug_dbug = @saved_dbug;
39 SET @@GLOBAL.slave_exec_mode = @saved_exec_mode;