| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
# |
| 4 |
# Initialize test data |
| 5 |
connection master; |
| 6 |
CREATE TABLE t1 ( |
| 7 |
id INTEGER PRIMARY KEY AUTO_INCREMENT, |
| 8 |
f2 INTEGER |
| 9 |
) engine=innodb; |
| 10 |
CREATE TABLE t2 ( |
| 11 |
id INT PRIMARY KEY AUTO_INCREMENT, |
| 12 |
t1_id INT NOT NULL, |
| 13 |
f2 INTEGER NOT NULL, |
| 14 |
KEY key_t1_id(t1_id), |
| 15 |
CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE |
| 16 |
) engine=innodb; |
| 17 |
INSERT INTO t1 (f2) VALUES (0); |
| 18 |
INSERT INTO t1 (f2) VALUES (0); |
| 19 |
INSERT INTO t2 (t1_id, f2) VALUES (1,1234); |
| 20 |
connection slave; |
| 21 |
# |
| 22 |
# slave_exec_mode = IDEMPOTENT |
| 23 |
connection slave; |
| 24 |
set @saved_dbug = @@global.debug_dbug; |
| 25 |
set @saved_exec_mode= @@global.slave_exec_mode; |
| 26 |
set @@global.debug_dbug= "+d,rows_log_event_after_open_table"; |
| 27 |
include/stop_slave.inc |
| 28 |
set global slave_exec_mode='IDEMPOTENT'; |
| 29 |
include/start_slave.inc |
| 30 |
# INSERT on master so it is replicated to slave (where its execution will be blocked after taking locks) |
| 31 |
connection master; |
| 32 |
INSERT INTO t1 (f2) VALUES (0); |
| 33 |
connection slave; |
| 34 |
set debug_sync='now WAIT_FOR after_open_table'; |
| 35 |
# test.t1 should always be locked with SHARED_WRITE |
| 36 |
# test.t2 lock type should be SHARED_WRITE only when slave_exec_mode is IDEMPOTENT. Current mode: IDEMPOTENT |
| 37 |
connection slave; |
| 38 |
SET DEBUG_SYNC= 'RESET'; |
| 39 |
set debug_sync='now SIGNAL continue_rows_ev'; |
| 40 |
SET @@GLOBAL.debug_dbug = @saved_dbug; |
| 41 |
SET @@GLOBAL.slave_exec_mode = @saved_exec_mode; |
| 42 |
# |
| 43 |
# slave_exec_mode = STRICT |
| 44 |
connection slave; |
| 45 |
set @saved_dbug = @@global.debug_dbug; |
| 46 |
set @saved_exec_mode= @@global.slave_exec_mode; |
| 47 |
set @@global.debug_dbug= "+d,rows_log_event_after_open_table"; |
| 48 |
include/stop_slave.inc |
| 49 |
set global slave_exec_mode='STRICT'; |
| 50 |
include/start_slave.inc |
| 51 |
# INSERT on master so it is replicated to slave (where its execution will be blocked after taking locks) |
| 52 |
connection master; |
| 53 |
INSERT INTO t1 (f2) VALUES (0); |
| 54 |
connection slave; |
| 55 |
set debug_sync='now WAIT_FOR after_open_table'; |
| 56 |
# test.t1 should always be locked with SHARED_WRITE |
| 57 |
# test.t2 lock type should be SHARED_WRITE only when slave_exec_mode is IDEMPOTENT. Current mode: STRICT |
| 58 |
connection slave; |
| 59 |
SET DEBUG_SYNC= 'RESET'; |
| 60 |
set debug_sync='now SIGNAL continue_rows_ev'; |
| 61 |
SET @@GLOBAL.debug_dbug = @saved_dbug; |
| 62 |
SET @@GLOBAL.slave_exec_mode = @saved_exec_mode; |
| 63 |
connection master; |
| 64 |
DROP TABLE t2; |
| 65 |
DROP TABLE t1; |
| 66 |
connection slave; |
| 67 |
include/rpl_end.inc |
| 68 |
# End of rpl_row_foreign_key_mdl.test |