mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-26: Global transaction ID. First alpha release.
Merge of 10.0-mdev26 feature tree into 10.0-base. Global transaction ID is prepended to each event group in the binlog. Slave connect can request to start from GTID position instead of specifying file name/offset of master binlog. This facilitates easy switch to a new master. Slave GTID state is stored in a table mysql.rpl_slave_state, which can be InnoDB to get crash-safe slave state. GTID includes a replication domain ID, allowing to keep track of distinct positions for each of multiple masters.
This commit is contained in:
110
mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
Normal file
110
mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
Normal file
@@ -0,0 +1,110 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
*** Test that we check against incorrect table definition for mysql.rpl_slave_state ***
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
include/stop_slave.inc
|
||||
ALTER TABLE mysql.rpl_slave_state CHANGE seq_no seq_no VARCHAR(20);
|
||||
START SLAVE;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
CALL mtr.add_suppression("Slave: Failed to open mysql.rpl_slave_state");
|
||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
||||
include/stop_slave.inc
|
||||
ALTER TABLE mysql.rpl_slave_state CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY;
|
||||
ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (sub_id, domain_id);
|
||||
START SLAVE;
|
||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
||||
include/stop_slave.inc
|
||||
ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY;
|
||||
START SLAVE;
|
||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
||||
include/stop_slave.inc
|
||||
ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (sub_id);
|
||||
START SLAVE;
|
||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
||||
include/stop_slave.inc
|
||||
ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY;
|
||||
ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (domain_id, sub_id);
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
*** Test requesting an explicit GTID position that conflicts with newer GTIDs of our own in the binlog. ***
|
||||
include/stop_slave.inc
|
||||
RESET MASTER;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
SET sql_log_bin = 0;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SET sql_log_bin = 1;
|
||||
INSERT INTO t1 VALUES (3);
|
||||
CHANGE MASTER TO master_use_gtid=1;
|
||||
SET GLOBAL gtid_pos = "0-1-1";
|
||||
ERROR HY000: Requested GTID_POS 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
||||
SET GLOBAL gtid_pos = "";
|
||||
ERROR HY000: Requested GTID_POS contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
||||
RESET MASTER;
|
||||
SET GLOBAL gtid_pos = "0-1-1";
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
*** Test slave requesting a GTID that is not present in the master's binlog ***
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL gtid_pos = "0-1-3";
|
||||
START SLAVE;
|
||||
SET sql_log_bin=0;
|
||||
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'");
|
||||
SET sql_log_bin=1;
|
||||
include/wait_for_slave_io_error.inc [errno=1236]
|
||||
Slave_IO_State = ''
|
||||
Last_IO_Errno = '1236'
|
||||
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-3, which is not in the master's binlog''
|
||||
Using_Gtid = '1'
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL gtid_pos = "0-1-2";
|
||||
START SLAVE;
|
||||
include/wait_for_slave_to_start.inc
|
||||
INSERT INTO t1 VALUES (5);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
*** MDEV-4278: Slave does not detect that master is not GTID-aware ***
|
||||
include/stop_slave.inc
|
||||
SET @old_dbug= @@global.DEBUG_DBUG;
|
||||
SET GLOBAL debug_dbug="+d,simulate_non_gtid_aware_master";
|
||||
START SLAVE;
|
||||
include/wait_for_slave_io_error.inc [errno=1233]
|
||||
SET GLOBAL debug_dbug= @old_dbug;
|
||||
INSERT INTO t1 VALUES (6);
|
||||
START SLAVE;
|
||||
SET sql_log_bin=0;
|
||||
CALL mtr.add_suppression("The slave I/O thread stops because master does not support MariaDB global transaction id");
|
||||
SET sql_log_bin=1;
|
||||
*** Test error during record_gtid() (non-xid cases) ***
|
||||
include/stop_slave.inc
|
||||
CREATE TABLE t2 (a INT) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1);
|
||||
SET @old_dbug= @@global.DEBUG_DBUG;
|
||||
SET GLOBAL debug_dbug="+d,gtid_inject_record_gtid";
|
||||
START SLAVE;
|
||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
||||
SET GLOBAL debug_dbug= @old_dbug;
|
||||
START SLAVE SQL_THREAD;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
1
|
||||
1
|
||||
SET sql_log_bin=0;
|
||||
CALL mtr.add_suppression("Slave: Could not update replication slave gtid state");
|
||||
SET sql_log_bin=1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
include/rpl_end.inc
|
Reference in New Issue
Block a user