mirror of
https://github.com/MariaDB/server.git
synced 2025-11-28 17:36:30 +03:00
When @@GLOBAL.gtid_strict_mode=1, then certain operations result in error that would otherwise result in out-of-order binlog files between servers. GTID sequence numbers are now allocated independently per domain; this results in less/no holes in GTID sequences, increasing the likelyhood that diverging binlogs will be caught by the slave when GTID strict mode is enabled.
126 lines
4.9 KiB
Plaintext
126 lines
4.9 KiB
Plaintext
include/master-slave.inc
|
|
[connection master]
|
|
*** Test that we check against incorrect table definition for mysql.gtid_slave_pos ***
|
|
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
include/stop_slave.inc
|
|
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20);
|
|
START SLAVE;
|
|
INSERT INTO t1 VALUES (1);
|
|
CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos");
|
|
include/wait_for_slave_sql_error.inc [errno=1942]
|
|
include/stop_slave.inc
|
|
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
|
|
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
|
ALTER TABLE mysql.gtid_slave_pos 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.gtid_slave_pos DROP PRIMARY KEY;
|
|
START SLAVE;
|
|
include/wait_for_slave_sql_error.inc [errno=1942]
|
|
include/stop_slave.inc
|
|
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id);
|
|
START SLAVE;
|
|
include/wait_for_slave_sql_error.inc [errno=1942]
|
|
include/stop_slave.inc
|
|
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
|
ALTER TABLE mysql.gtid_slave_pos 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=current_pos;
|
|
BEGIN;
|
|
SET GLOBAL gtid_slave_pos = "100-100-100";
|
|
ERROR 25000: You are not allowed to execute this command in a transaction
|
|
INSERT INTO t1 VALUES (100);
|
|
SET GLOBAL gtid_slave_pos = "100-100-100";
|
|
ERROR 25000: You are not allowed to execute this command in a transaction
|
|
ROLLBACK;
|
|
SET GLOBAL gtid_strict_mode= 1;
|
|
SET GLOBAL gtid_slave_pos = "0-1-1";
|
|
ERROR 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.
|
|
SET GLOBAL gtid_slave_pos = "";
|
|
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-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos.
|
|
SET GLOBAL gtid_strict_mode= 0;
|
|
SET GLOBAL gtid_slave_pos = "0-1-1";
|
|
Warnings:
|
|
Warning 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.
|
|
SET GLOBAL gtid_slave_pos = "";
|
|
Warnings:
|
|
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-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos.
|
|
RESET MASTER;
|
|
SET GLOBAL gtid_slave_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_slave_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 = 'Current_Pos'
|
|
include/stop_slave.inc
|
|
SET GLOBAL gtid_slave_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
|