| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
*** Test that we check against incorrect table definition for mysql.gtid_slave_pos *** |
| 4 |
connection master; |
| 5 |
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; |
| 6 |
call mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos:.*"); |
| 7 |
connection slave; |
| 8 |
connection slave; |
| 9 |
include/stop_slave.inc |
| 10 |
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20); |
| 11 |
START SLAVE; |
| 12 |
connection master; |
| 13 |
INSERT INTO t1 VALUES (1); |
| 14 |
connection slave; |
| 15 |
CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos"); |
| 16 |
include/wait_for_slave_sql_error.inc [errno=1944] |
| 17 |
include/stop_slave.inc |
| 18 |
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL; |
| 19 |
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; |
| 20 |
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id); |
| 21 |
START SLAVE; |
| 22 |
include/wait_for_slave_sql_error.inc [errno=1944] |
| 23 |
include/stop_slave.inc |
| 24 |
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; |
| 25 |
START SLAVE; |
| 26 |
include/wait_for_slave_sql_error.inc [errno=1944] |
| 27 |
include/stop_slave.inc |
| 28 |
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id); |
| 29 |
START SLAVE; |
| 30 |
include/wait_for_slave_sql_error.inc [errno=1944] |
| 31 |
include/stop_slave.inc |
| 32 |
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; |
| 33 |
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id); |
| 34 |
include/start_slave.inc |
| 35 |
connection master; |
| 36 |
connection slave; |
| 37 |
connection slave; |
| 38 |
SELECT * FROM t1; |
| 39 |
a |
| 40 |
1 |
| 41 |
*** Test that setting @@gtid_domain_id or @@gtid_seq_no is not allowed inside a transaction. *** |
| 42 |
BEGIN; |
| 43 |
INSERT INTO t1 VALUES (100); |
| 44 |
SET SESSION gtid_domain_id= 100; |
| 45 |
ERROR HY000: Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a transaction |
| 46 |
SET SESSION gtid_seq_no= 100; |
| 47 |
ERROR HY000: Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a transaction |
| 48 |
SET @old_domain= @@GLOBAL.gtid_domain_id; |
| 49 |
SET GLOBAL gtid_domain_id= 100; |
| 50 |
SELECT @@SESSION.gtid_domain_id; |
| 51 |
@@SESSION.gtid_domain_id |
| 52 |
0 |
| 53 |
SET GLOBAL gtid_domain_id= @old_domain; |
| 54 |
INSERT INTO t1 VALUES (101); |
| 55 |
SELECT * FROM t1 ORDER BY a; |
| 56 |
a |
| 57 |
1 |
| 58 |
100 |
| 59 |
101 |
| 60 |
ROLLBACK; |
| 61 |
SELECT * FROM t1 ORDER BY a; |
| 62 |
a |
| 63 |
1 |
| 64 |
SET @old_mode= @@SESSION.binlog_format; |
| 65 |
SET SESSION binlog_format= row; |
| 66 |
SET SESSION gtid_domain_id= 200; |
| 67 |
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 68 |
SET SESSION gtid_domain_id= 0; |
| 69 |
BEGIN; |
| 70 |
INSERT INTO t2 VALUES (200); |
| 71 |
INSERT INTO t1 SELECT * FROM t2; |
| 72 |
COMMIT; |
| 73 |
SET SESSION gtid_domain_id= 201; |
| 74 |
SET SESSION gtid_domain_id= 0; |
| 75 |
DELETE FROM t1 WHERE a=200; |
| 76 |
SET SESSION gtid_domain_id= 202; |
| 77 |
DROP TEMPORARY TABLE t2; |
| 78 |
SET SESSION binlog_format= mixed; |
| 79 |
SET SESSION gtid_domain_id= 0; |
| 80 |
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 81 |
INSERT INTO t2 VALUES (1); |
| 82 |
SET SESSION gtid_domain_id= 0; |
| 83 |
SET SESSION gtid_domain_id= 204; |
| 84 |
ERROR HY000: Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a transaction |
| 85 |
SET SESSION binlog_format=statement; |
| 86 |
INSERT INTO t2 VALUES (2); |
| 87 |
SET SESSION gtid_domain_id= 205; |
| 88 |
ERROR HY000: Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a transaction |
| 89 |
DROP TEMPORARY TABLE t2; |
| 90 |
SET SESSION gtid_domain_id= @old_domain; |
| 91 |
SET SESSION binlog_format= @old_mode; |
| 92 |
*** Test requesting an explicit GTID position that conflicts with newer GTIDs of our own in the binlog. *** |
| 93 |
connection slave; |
| 94 |
include/stop_slave.inc |
| 95 |
connection master; |
| 96 |
RESET MASTER; |
| 97 |
INSERT INTO t1 VALUES (2); |
| 98 |
INSERT INTO t1 VALUES (4); |
| 99 |
include/save_master_gtid.inc |
| 100 |
connection slave; |
| 101 |
SET sql_log_bin = 0; |
| 102 |
INSERT INTO t1 VALUES (2); |
| 103 |
SET sql_log_bin = 1; |
| 104 |
INSERT INTO t1 VALUES (3); |
| 105 |
CHANGE MASTER TO master_use_gtid=current_pos; |
| 106 |
BEGIN; |
| 107 |
SET GLOBAL gtid_slave_pos = "100-100-100"; |
| 108 |
ERROR 25000: You are not allowed to execute this command in a transaction |
| 109 |
INSERT INTO t1 VALUES (100); |
| 110 |
SET GLOBAL gtid_slave_pos = "100-100-100"; |
| 111 |
ERROR 25000: You are not allowed to execute this command in a transaction |
| 112 |
ROLLBACK; |
| 113 |
SET GLOBAL gtid_strict_mode= 1; |
| 114 |
SET GLOBAL gtid_slave_pos = "0-1-1"; |
| 115 |
ERROR HY000: Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-18. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos |
| 116 |
SET GLOBAL gtid_slave_pos = ""; |
| 117 |
ERROR HY000: Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-18. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos |
| 118 |
SET GLOBAL gtid_strict_mode= 0; |
| 119 |
SET GLOBAL gtid_slave_pos = "0-1-1"; |
| 120 |
Warnings: |
| 121 |
Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-18. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos |
| 122 |
SET GLOBAL gtid_slave_pos = ""; |
| 123 |
Warnings: |
| 124 |
Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-18. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos |
| 125 |
RESET MASTER; |
| 126 |
SET GLOBAL gtid_slave_pos = "0-1-1"; |
| 127 |
START SLAVE; |
| 128 |
include/sync_with_master_gtid.inc |
| 129 |
SELECT * FROM t1 ORDER BY a; |
| 130 |
a |
| 131 |
1 |
| 132 |
2 |
| 133 |
3 |
| 134 |
4 |
| 135 |
*** MDEV-4688: Empty value of @@GLOBAL.gtid_slave_pos *** |
| 136 |
include/stop_slave.inc |
| 137 |
connection master; |
| 138 |
INSERT INTO t1 VALUES (5); |
| 139 |
include/save_master_gtid.inc |
| 140 |
connection slave; |
| 141 |
SET @old_dbug= @@GLOBAL.debug_dbug; |
| 142 |
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output"; |
| 143 |
SET GLOBAL debug_dbug="+d,gtid_fail_after_record_gtid"; |
| 144 |
SET sql_log_bin=0; |
| 145 |
CALL mtr.add_suppression('Got error 131 "Command not supported by the engine" during COMMIT'); |
| 146 |
SET sql_log_bin=1; |
| 147 |
START SLAVE; |
| 148 |
include/wait_for_slave_sql_error.inc [errno=1180] |
| 149 |
SELECT @@GLOBAL.gtid_slave_pos; |
| 150 |
@@GLOBAL.gtid_slave_pos |
| 151 |
0-1-2 |
| 152 |
SELECT * FROM t1 ORDER BY a; |
| 153 |
a |
| 154 |
1 |
| 155 |
2 |
| 156 |
3 |
| 157 |
4 |
| 158 |
SET GLOBAL debug_dbug= @old_dbug; |
| 159 |
START SLAVE SQL_THREAD; |
| 160 |
include/sync_with_master_gtid.inc |
| 161 |
SELECT * FROM t1 ORDER BY a; |
| 162 |
a |
| 163 |
1 |
| 164 |
2 |
| 165 |
3 |
| 166 |
4 |
| 167 |
5 |
| 168 |
*** Test slave requesting a GTID that is not present in the master's binlog *** |
| 169 |
include/stop_slave.inc |
| 170 |
SET GLOBAL gtid_slave_pos = "0-1-4"; |
| 171 |
START SLAVE; |
| 172 |
SET sql_log_bin=0; |
| 173 |
CALL mtr.add_suppression("Got fatal error .* from master when reading data from binary log: 'Error: connecting slave requested to start from GTID .*, which is not in the master's binlog'"); |
| 174 |
SET sql_log_bin=1; |
| 175 |
include/wait_for_slave_io_error.inc [errno=1236] |
| 176 |
Slave_IO_State = '' |
| 177 |
Last_IO_Errno = '1236' |
| 178 |
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Error: connecting slave requested to start from GTID 0-1-4, which is not in the master's binlog'' |
| 179 |
Using_Gtid = 'Current_Pos' |
| 180 |
include/stop_slave.inc |
| 181 |
SET GLOBAL gtid_slave_pos = "0-1-3"; |
| 182 |
START SLAVE; |
| 183 |
include/wait_for_slave_to_start.inc |
| 184 |
connection master; |
| 185 |
INSERT INTO t1 VALUES (6); |
| 186 |
include/save_master_gtid.inc |
| 187 |
connection slave; |
| 188 |
include/sync_with_master_gtid.inc |
| 189 |
SELECT * FROM t1 ORDER BY a; |
| 190 |
a |
| 191 |
1 |
| 192 |
2 |
| 193 |
3 |
| 194 |
4 |
| 195 |
5 |
| 196 |
6 |
| 197 |
*** MDEV-4278: Slave does not detect that master is not GTID-aware *** |
| 198 |
connection slave; |
| 199 |
include/stop_slave.inc |
| 200 |
connection master; |
| 201 |
SET @old_dbug= @@global.DEBUG_DBUG; |
| 202 |
SET GLOBAL debug_dbug="+d,simulate_non_gtid_aware_master"; |
| 203 |
connection slave; |
| 204 |
START SLAVE; |
| 205 |
include/wait_for_slave_io_error.inc [errno=1233] |
| 206 |
connection master; |
| 207 |
SET GLOBAL debug_dbug= @old_dbug; |
| 208 |
INSERT INTO t1 VALUES (7); |
| 209 |
connection slave; |
| 210 |
START SLAVE; |
| 211 |
SET sql_log_bin=0; |
| 212 |
CALL mtr.add_suppression("The slave I/O thread stops because master does not support MariaDB global transaction id"); |
| 213 |
SET sql_log_bin=1; |
| 214 |
*** Test error during record_gtid() (non-xid cases) *** |
| 215 |
connection slave; |
| 216 |
include/stop_slave.inc |
| 217 |
connection master; |
| 218 |
CREATE TABLE t2 (a INT) ENGINE=MyISAM; |
| 219 |
INSERT INTO t2 VALUES (1); |
| 220 |
connection slave; |
| 221 |
SET @old_dbug= @@global.DEBUG_DBUG; |
| 222 |
SET GLOBAL debug_dbug="+d,gtid_inject_record_gtid"; |
| 223 |
START SLAVE; |
| 224 |
include/wait_for_slave_sql_error.inc [errno=1942] |
| 225 |
SET GLOBAL debug_dbug= @old_dbug; |
| 226 |
START SLAVE SQL_THREAD; |
| 227 |
SELECT * FROM t2; |
| 228 |
a |
| 229 |
1 |
| 230 |
1 |
| 231 |
SET sql_log_bin=0; |
| 232 |
CALL mtr.add_suppression("Slave: Could not update replication slave gtid state"); |
| 233 |
SET sql_log_bin=1; |
| 234 |
*** MDEV-4906: When event apply fails, next SQL thread start erroneously commits the failing GTID to gtid_slave_pos *** |
| 235 |
connection slave; |
| 236 |
include/stop_slave.inc |
| 237 |
SET sql_log_bin=0; |
| 238 |
DELETE FROM t2; |
| 239 |
SET sql_log_bin=1; |
| 240 |
SET @old_format=@@binlog_format; |
| 241 |
SET GLOBAL binlog_format='row'; |
| 242 |
include/start_slave.inc |
| 243 |
connection master; |
| 244 |
SET @old_format=@@binlog_format; |
| 245 |
SET binlog_format='row'; |
| 246 |
DELETE FROM t2; |
| 247 |
SET binlog_format=@old_format; |
| 248 |
connection slave; |
| 249 |
include/wait_for_slave_sql_error.inc [errno=1032] |
| 250 |
result |
| 251 |
OK |
| 252 |
STOP SLAVE IO_THREAD; |
| 253 |
START SLAVE; |
| 254 |
include/wait_for_slave_sql_error.inc [errno=1032] |
| 255 |
result |
| 256 |
OK |
| 257 |
STOP SLAVE IO_THREAD; |
| 258 |
SET sql_log_bin=0; |
| 259 |
INSERT INTO t2 VALUES (1); |
| 260 |
CALL mtr.add_suppression("Slave: Can't find record in 't2' Error_code: 1032"); |
| 261 |
SET sql_log_bin=1; |
| 262 |
include/start_slave.inc |
| 263 |
SET GLOBAL binlog_format=@old_format; |
| 264 |
connection master; |
| 265 |
DROP TABLE t1; |
| 266 |
DROP TABLE t2; |
| 267 |
call mtr.add_suppression("Can't find record in 't2'"); |
| 268 |
include/rpl_end.inc |