| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection slave; |
| 4 |
call mtr.add_suppression("Slave: ER_CONNECTION_KILLED .* is not allowed in --slave-skip-errors"); |
| 5 |
include/assert_grep.inc [Warning about ER_CONNECTION_KILLED should appear in error log] |
| 6 |
connection slave; |
| 7 |
connection master; |
| 8 |
==== Test Without sql_mode=strict_trans_tables ==== |
| 9 |
create table t1 (n int not null primary key); |
| 10 |
connection slave; |
| 11 |
insert into t1 values (1); |
| 12 |
connection master; |
| 13 |
insert into t1 values (1); |
| 14 |
insert into t1 values (2),(3); |
| 15 |
connection slave; |
| 16 |
select * from t1 order by n; |
| 17 |
n |
| 18 |
1 |
| 19 |
2 |
| 20 |
3 |
| 21 |
==== Test With sql_mode=strict_trans_tables ==== |
| 22 |
insert into t1 values (7),(8); |
| 23 |
connection master; |
| 24 |
set sql_mode=strict_trans_tables; |
| 25 |
insert into t1 values (7), (8), (9); |
| 26 |
connection slave; |
| 27 |
select * from t1 order by n; |
| 28 |
n |
| 29 |
1 |
| 30 |
2 |
| 31 |
3 |
| 32 |
7 |
| 33 |
8 |
| 34 |
include/check_slave_is_running.inc |
| 35 |
==== Clean Up ==== |
| 36 |
connection master; |
| 37 |
drop table t1; |
| 38 |
connection slave; |
| 39 |
connection master; |
| 40 |
create table t1(a int primary key); |
| 41 |
insert into t1 values (1),(2); |
| 42 |
SET SQL_LOG_BIN=0; |
| 43 |
delete from t1; |
| 44 |
SET SQL_LOG_BIN=1; |
| 45 |
set sql_mode=strict_trans_tables; |
| 46 |
insert into t1 values (1), (2), (3); |
| 47 |
connection slave; |
| 48 |
select * from t1; |
| 49 |
a |
| 50 |
1 |
| 51 |
2 |
| 52 |
include/check_slave_is_running.inc |
| 53 |
==== Clean Up ==== |
| 54 |
connection master; |
| 55 |
drop table t1; |
| 56 |
connection slave; |
| 57 |
==== Using Innodb ==== |
| 58 |
connection master; |
| 59 |
SET SQL_LOG_BIN=0; |
| 60 |
CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB; |
| 61 |
SHOW CREATE TABLE t1; |
| 62 |
Table Create Table |
| 63 |
t1 CREATE TABLE `t1` ( |
| 64 |
`id` int(11) NOT NULL, |
| 65 |
`data` int(11) DEFAULT NULL, |
| 66 |
PRIMARY KEY (`id`) |
| 67 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 68 |
SET SQL_LOG_BIN=1; |
| 69 |
connection slave; |
| 70 |
call mtr.add_suppression("Slave SQL.*Could not execute .*te_rows event on table test.t.; Duplicate entry.* error.* 1062"); |
| 71 |
CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB; |
| 72 |
SHOW CREATE TABLE t1; |
| 73 |
Table Create Table |
| 74 |
t1 CREATE TABLE `t1` ( |
| 75 |
`id` int(11) NOT NULL, |
| 76 |
`data` int(11) DEFAULT NULL, |
| 77 |
PRIMARY KEY (`id`) |
| 78 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 79 |
connection master; |
| 80 |
INSERT INTO t1 VALUES(1, 1); |
| 81 |
INSERT INTO t1 VALUES(2, 1); |
| 82 |
INSERT INTO t1 VALUES(3, 1); |
| 83 |
INSERT INTO t1 VALUES(4, 1); |
| 84 |
SET SQL_LOG_BIN=0; |
| 85 |
DELETE FROM t1 WHERE id = 4; |
| 86 |
SET SQL_LOG_BIN=1; |
| 87 |
UPDATE t1 SET id= id + 3, data = 2; |
| 88 |
connection slave; |
| 89 |
|
| 90 |
**** We cannot execute a select as there are differences in the |
| 91 |
**** behavior between STMT and RBR. |
| 92 |
==== Using MyIsam ==== |
| 93 |
connection master; |
| 94 |
SET SQL_LOG_BIN=0; |
| 95 |
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam; |
| 96 |
SHOW CREATE TABLE t2; |
| 97 |
Table Create Table |
| 98 |
t2 CREATE TABLE `t2` ( |
| 99 |
`id` int(11) NOT NULL, |
| 100 |
`data` int(11) DEFAULT NULL, |
| 101 |
PRIMARY KEY (`id`) |
| 102 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 103 |
SET SQL_LOG_BIN=1; |
| 104 |
connection slave; |
| 105 |
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam; |
| 106 |
SHOW CREATE TABLE t2; |
| 107 |
Table Create Table |
| 108 |
t2 CREATE TABLE `t2` ( |
| 109 |
`id` int(11) NOT NULL, |
| 110 |
`data` int(11) DEFAULT NULL, |
| 111 |
PRIMARY KEY (`id`) |
| 112 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 113 |
# Slave_skipped_errros = 4 |
| 114 |
connection master; |
| 115 |
INSERT INTO t2 VALUES(1, 1); |
| 116 |
INSERT INTO t2 VALUES(2, 1); |
| 117 |
INSERT INTO t2 VALUES(3, 1); |
| 118 |
INSERT INTO t2 VALUES(5, 1); |
| 119 |
SET SQL_LOG_BIN=0; |
| 120 |
DELETE FROM t2 WHERE id = 5; |
| 121 |
SET SQL_LOG_BIN=1; |
| 122 |
UPDATE t2 SET id= id + 3, data = 2; |
| 123 |
connection slave; |
| 124 |
|
| 125 |
# Slave_skipped_errros = 5 |
| 126 |
**** We cannot execute a select as there are differences in the |
| 127 |
**** behavior between STMT and RBR. |
| 128 |
**** |
| 129 |
**** Ensure transactions which are skipped due to encountering a |
| 130 |
**** non-deadlock error which is present in --slave-skip-errors result |
| 131 |
**** in partially committed transactions |
| 132 |
connection master; |
| 133 |
CREATE TABLE t3 (a INT UNIQUE) ENGINE=InnoDB; |
| 134 |
connection slave; |
| 135 |
connection slave; |
| 136 |
INSERT INTO t3 VALUES (3); |
| 137 |
connection master; |
| 138 |
BEGIN; |
| 139 |
INSERT INTO t3 VALUES (1); |
| 140 |
INSERT INTO t3 VALUES (2); |
| 141 |
INSERT INTO t3 VALUES (3); |
| 142 |
INSERT INTO t3 VALUES (4); |
| 143 |
COMMIT; |
| 144 |
connection slave; |
| 145 |
**** Master and slave tables should have the same data, due to the |
| 146 |
**** partially replicated transaction's data overlapping with the data |
| 147 |
**** that pre-existed on the slave. That is, despite the transaction |
| 148 |
**** consisting of 4 statements, the errored statement should be ignored |
| 149 |
**** and the other 3 should commit successfully. |
| 150 |
include/diff_tables.inc [master:t3,slave:t3] |
| 151 |
connection master; |
| 152 |
DROP TABLE t3; |
| 153 |
==== Clean Up ==== |
| 154 |
connection master; |
| 155 |
DROP TABLE t1; |
| 156 |
DROP TABLE t2; |
| 157 |
connection slave; |
| 158 |
include/rpl_end.inc |