| 1 |
# |
| 2 |
# Test verifies replay of binary logs which contain |
| 3 |
# SA/RA/CA works fine. |
| 4 |
# Generate a binary log with alter events and use mysqlbinlog tool to |
| 5 |
# generate a sql file for replay. Source it on an clean master and |
| 6 |
# verify the correctness. Use the latest binlog and repeat the same |
| 7 |
# process mentioned above and observe replay works fine. |
| 8 |
# |
| 9 |
set global binlog_alter_two_phase = ON; |
| 10 |
set binlog_alter_two_phase = ON; |
| 11 |
create table t1 (f1 int primary key) engine=InnoDB; |
| 12 |
create table t2 (f1 int primary key, constraint c1 foreign key (f1) references t1(f1)) engine=innodb; |
| 13 |
alter table t2 add constraint c1 foreign key (f1) references t1(f1); |
| 14 |
ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") |
| 15 |
drop table t2, t1; |
| 16 |
select @@gtid_binlog_state; |
| 17 |
@@gtid_binlog_state |
| 18 |
0-1-5 |
| 19 |
FLUSH LOGS; |
| 20 |
# reset the binlog |
| 21 |
RESET MASTER; |
| 22 |
# execute the binlog |
| 23 |
SELECT @@gtid_binlog_state; |
| 24 |
@@gtid_binlog_state |
| 25 |
0-1-5 |
| 26 |
FLUSH LOGS; |
| 27 |
# Replay 1: One more time to simulate S->S case |
| 28 |
RESET MASTER; |
| 29 |
# execute the binlog |
| 30 |
SELECT @@gtid_binlog_state; |
| 31 |
@@gtid_binlog_state |
| 32 |
0-1-5 |
| 33 |
FLUSH LOGS; |
| 34 |
# Replay 2: One more time to simulate S->S case |
| 35 |
RESET MASTER; |
| 36 |
# execute the binlog |
| 37 |
SELECT @@gtid_binlog_state; |
| 38 |
@@gtid_binlog_state |
| 39 |
0-1-5 |
| 40 |
# clean up |
| 41 |
RESET MASTER; |
| 42 |
set global binlog_alter_two_phase=0; |