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