mirror of
https://github.com/MariaDB/server.git
synced 2025-11-30 05:23:50 +03:00
MDEV-26: Global transaction ID.
Change of user interface to be more logical and more in line with expectations to work similar to old-style replication. User can now explicitly choose in CHANGE MASTER whether binlog position is taken into account (master_gtid_pos=current_pos) or not (master_gtid_pos= slave_pos) when slave connects to master. @@gtid_pos is replaced by three separate variables @@gtid_slave_pos (can be set by user, replicated GTIDs only), @@gtid_binlog_pos (read only), and @@gtid_current_pos (a combination of the two, most recent GTID within each domain). mysql.rpl_slave_state is renamed to mysql.gtid_slave_pos to match. This fixes MDEV-4474.
This commit is contained in:
@@ -49,7 +49,7 @@ include/stop_slave.inc
|
||||
INSERT INTO t1 VALUES (5, "m1a");
|
||||
INSERT INTO t2 VALUES (5, "i1a");
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
@@ -68,7 +68,7 @@ a b
|
||||
*** Now move B to D (C is still replicating from B) ***
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
UPDATE t2 SET b="j1a" WHERE a=5;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
@@ -92,7 +92,7 @@ INSERT INTO t2 VALUES (6, "i6b");
|
||||
INSERT INTO t2 VALUES (7, "i7b");
|
||||
COMMIT;
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
a b
|
||||
|
||||
@@ -3,12 +3,12 @@ include/rpl_init.inc [topology=1->2]
|
||||
call mtr.add_suppression("Checking table:");
|
||||
call mtr.add_suppression("client is using or hasn't closed the table properly");
|
||||
call mtr.add_suppression("Table .* is marked as crashed and should be repaired");
|
||||
ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
INSERT INTO t1 VALUES (2,1);
|
||||
INSERT INTO t1 VALUES (3,1);
|
||||
include/start_slave.inc
|
||||
@@ -20,7 +20,7 @@ DROP TABLE t1;
|
||||
*** Test crashing the master mysqld and check that binlog state is recovered. ***
|
||||
include/stop_slave.inc
|
||||
RESET MASTER;
|
||||
SET GLOBAL gtid_pos='';
|
||||
SET GLOBAL gtid_slave_pos='';
|
||||
RESET MASTER;
|
||||
SHOW BINLOG EVENTS IN 'master-bin.000001' LIMIT 1,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
*** Test that we check against incorrect table definition for mysql.rpl_slave_state ***
|
||||
*** 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.rpl_slave_state CHANGE seq_no seq_no VARCHAR(20);
|
||||
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.rpl_slave_state");
|
||||
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.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);
|
||||
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.rpl_slave_state DROP PRIMARY KEY;
|
||||
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.rpl_slave_state ADD PRIMARY KEY (sub_id);
|
||||
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.rpl_slave_state DROP PRIMARY KEY;
|
||||
ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (domain_id, sub_id);
|
||||
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
|
||||
@@ -38,13 +38,22 @@ 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
|
||||
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_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_pos = "0-1-1";
|
||||
SET GLOBAL gtid_slave_pos = "0-1-1";
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
@@ -54,7 +63,7 @@ a
|
||||
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";
|
||||
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'");
|
||||
@@ -63,9 +72,9 @@ 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'
|
||||
Using_Gtid = 'Current_Pos'
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL gtid_pos = "0-1-2";
|
||||
SET GLOBAL gtid_slave_pos = "0-1-2";
|
||||
START SLAVE;
|
||||
include/wait_for_slave_to_start.inc
|
||||
INSERT INTO t1 VALUES (5);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
include/rpl_init.inc [topology=1->2, 1->3, 1->4, 1->5]
|
||||
ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
CREATE TABLE t4 (a INT, b INT, PRIMARY KEY (a,b)) Engine=InnoDB;
|
||||
CREATE FUNCTION extract_gtid(d VARCHAR(100), s VARCHAR(100))
|
||||
RETURNS VARCHAR(100) DETERMINISTIC
|
||||
@@ -10,13 +10,13 @@ SET s= SUBSTR(s FROM 1 FOR LOCATE(",", s) - 1);
|
||||
RETURN s;
|
||||
END|
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_use_gtid=1;
|
||||
CHANGE MASTER TO master_use_gtid=current_pos;
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_use_gtid=1;
|
||||
CHANGE MASTER TO master_use_gtid=current_pos;
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_use_gtid=1;
|
||||
CHANGE MASTER TO master_use_gtid=current_pos;
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_use_gtid=1;
|
||||
CHANGE MASTER TO master_use_gtid=current_pos;
|
||||
SET gtid_domain_id= 1;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@@ -310,7 +310,7 @@ a b
|
||||
3 5
|
||||
*** Now let the old master join up as slave. ***
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
|
||||
master_user = "root", master_use_gtid = 1;
|
||||
master_user = "root", master_use_gtid = current_pos;
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
|
||||
@@ -8,7 +8,7 @@ include/stop_slave.inc
|
||||
include/wait_for_slave_to_stop.inc
|
||||
reset slave all;
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
|
||||
master_user='root', MASTER_USE_GTID=1;
|
||||
master_user='root', MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
include/wait_for_slave_to_start.inc
|
||||
flush logs;
|
||||
@@ -16,7 +16,7 @@ insert into t1 values (3);
|
||||
insert into t1 values (4);
|
||||
flush logs;
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
select * from t1 order by n;
|
||||
n
|
||||
@@ -47,11 +47,11 @@ include/stop_slave.inc
|
||||
include/wait_for_slave_to_stop.inc
|
||||
reset slave all;
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
|
||||
master_user = 'root', MASTER_USE_GTID=1;
|
||||
master_user = 'root', MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
drop table t1;
|
||||
include/rpl_end.inc
|
||||
|
||||
63
mysql-test/suite/rpl/r/rpl_gtid_mdev4474.result
Normal file
63
mysql-test/suite/rpl/r/rpl_gtid_mdev4474.result
Normal file
@@ -0,0 +1,63 @@
|
||||
include/rpl_init.inc [topology=1->2->1]
|
||||
#
|
||||
# For now we'll only have 1->2 running
|
||||
#
|
||||
# Server 1
|
||||
# Stop replication 2->1
|
||||
include/stop_slave.inc
|
||||
#
|
||||
# Server 2
|
||||
# Use GTID for replication 1->2
|
||||
include/stop_slave.inc
|
||||
change master to master_use_gtid=slave_pos;
|
||||
include/start_slave.inc
|
||||
#
|
||||
# Create some 0-1-* and 0-2-* events in binlog of server 2
|
||||
connection server_1;
|
||||
create table t1 (i int) engine=InnoDB;
|
||||
insert into t1 values (1);
|
||||
connection server_2;
|
||||
create table t2 (i int) engine=InnoDB;
|
||||
connection server_1;
|
||||
insert into t1 values (2);
|
||||
connection server_2;
|
||||
insert into t2 values (1);
|
||||
#
|
||||
# All events are present in the binlog of server 2
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; create table t1 (i int) engine=InnoDB
|
||||
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
slave-bin.000001 # Xid # # COMMIT /* XID */
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; create table t2 (i int) engine=InnoDB
|
||||
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; insert into t1 values (2)
|
||||
slave-bin.000001 # Xid # # COMMIT /* XID */
|
||||
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; insert into t2 values (1)
|
||||
slave-bin.000001 # Xid # # COMMIT /* XID */
|
||||
#
|
||||
# Server 1
|
||||
# Start replication 2->1 using GTID,
|
||||
change master to master_use_gtid=slave_pos;
|
||||
include/start_slave.inc
|
||||
select * from t1 order by i;
|
||||
i
|
||||
1
|
||||
2
|
||||
select * from t2 order by i;
|
||||
i
|
||||
1
|
||||
select * from t1 order by i;
|
||||
i
|
||||
1
|
||||
2
|
||||
select * from t2 order by i;
|
||||
i
|
||||
1
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
include/rpl_end.inc
|
||||
@@ -24,7 +24,7 @@ slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4, 2)
|
||||
slave-bin.000001 # Query # # COMMIT
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_PORT,
|
||||
master_user = 'root', master_use_gtid = 1;
|
||||
master_user = 'root', master_use_gtid = current_pos;
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
@@ -37,7 +37,7 @@ RESET SLAVE;
|
||||
INSERT INTO t1 VALUES (5, 1);
|
||||
INSERT INTO t1 VALUES (6, 1);
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
|
||||
master_use_gtid = 1;
|
||||
master_use_gtid = current_pos;
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
|
||||
@@ -6,9 +6,9 @@ RESET SLAVE;
|
||||
RESET MASTER;
|
||||
FLUSH LOGS;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
SET GLOBAL gtid_pos="";
|
||||
SET GLOBAL gtid_slave_pos="";
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
@@ -24,9 +24,9 @@ include/wait_for_purge.inc "master-bin.000003"
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
master-bin.000003 #
|
||||
SET GLOBAL gtid_pos="";
|
||||
SET GLOBAL gtid_slave_pos="";
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
START SLAVE;
|
||||
include/wait_for_slave_io_error.inc [errno=1236]
|
||||
include/stop_slave.inc
|
||||
@@ -40,12 +40,12 @@ a
|
||||
SET sql_log_bin=0;
|
||||
call mtr.add_suppression('Could not find GTID state requested by slave in any binlog files');
|
||||
SET sql_log_bin=1;
|
||||
*** Test that we give error when explict @@gtid_pos=xxx that conflicts with what is in our binary log ***
|
||||
*** Test that we give warning when explict @@gtid_slave_pos=xxx that conflicts with what is in our binary log ***
|
||||
include/stop_slave.inc
|
||||
INSERT INTO t1 VALUES(3);
|
||||
SET GLOBAL gtid_pos='0-1-3';
|
||||
SET GLOBAL gtid_slave_pos='0-1-3';
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
|
||||
MASTER_USE_GTID=1;
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t1 ORDER by a;
|
||||
a
|
||||
@@ -56,10 +56,11 @@ include/stop_slave.inc
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (10);
|
||||
DELETE FROM t1 WHERE a=10;
|
||||
SET GLOBAL gtid_pos='0-1-4';
|
||||
ERROR HY000: Requested GTID_POS 0-1-4 conflicts with the binary log which contains a more recent GTID 0-2-6. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
||||
SET GLOBAL gtid_slave_pos='0-1-4';
|
||||
Warnings:
|
||||
Warning 1947 Specified GTID 0-1-4 conflicts with the binary log which contains a more recent GTID 0-2-6. 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_pos='0-1-4';
|
||||
SET GLOBAL gtid_slave_pos='0-1-4';
|
||||
START SLAVE;
|
||||
SELECT * FROM t1 ORDER by a;
|
||||
a
|
||||
@@ -73,8 +74,8 @@ include/stop_slave.inc
|
||||
RESET SLAVE ALL;
|
||||
RESET MASTER;
|
||||
RESET MASTER;
|
||||
SET GLOBAL gtid_pos='';
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=1;
|
||||
SET GLOBAL gtid_slave_pos='';
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=current_pos;
|
||||
include/start_slave.inc
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@@ -89,14 +90,15 @@ SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
*** MDEV-4329: GTID_POS='' is not checked for conflicts with binlog ***
|
||||
*** MDEV-4329: GTID_SLAVE_POS='' is not checked for conflicts with binlog ***
|
||||
include/stop_slave.inc
|
||||
DROP TABLE t1;
|
||||
RESET SLAVE;
|
||||
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-4. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
||||
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-4. 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_pos="";
|
||||
SET GLOBAL gtid_slave_pos="";
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
@@ -107,7 +109,7 @@ SET SQL_LOG_BIN=0;
|
||||
DROP TABLE t1;
|
||||
SET SQL_LOG_BIN=1;
|
||||
RESET SLAVE;
|
||||
SET GLOBAL gtid_pos="";
|
||||
SET GLOBAL gtid_slave_pos="";
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
@@ -116,11 +118,11 @@ a
|
||||
*** Test that RESET SLAVE clears the Using_Gtid flag. ***
|
||||
include/stop_slave.inc
|
||||
RESET SLAVE;
|
||||
Using_Gtid = '0'
|
||||
Using_Gtid = 'No'
|
||||
START SLAVE;
|
||||
include/wait_for_slave_sql_error.inc [errno=1050]
|
||||
STOP SLAVE IO_THREAD;
|
||||
CHANGE MASTER TO MASTER_USE_GTID=1;
|
||||
CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
INSERT INTO t1 VALUES(3);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
@@ -154,7 +156,7 @@ a
|
||||
*** Test modifying binlog on slave and the effect on GTID state. ***
|
||||
include/stop_slave.inc
|
||||
RESET MASTER;
|
||||
SET GLOBAL gtid_pos="";
|
||||
SET GLOBAL gtid_slave_pos="";
|
||||
RESET MASTER;
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (10);
|
||||
@@ -162,28 +164,29 @@ include/start_slave.inc
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
10
|
||||
SELECT '1' AS Using_Gtid;
|
||||
SELECT 'Current_Pos' AS Using_Gtid;
|
||||
Using_Gtid
|
||||
1
|
||||
SELECT '0-1-2' AS Gtid_Pos;
|
||||
Gtid_Pos
|
||||
Current_Pos
|
||||
SELECT '0-1-2' AS Gtid_Slave_Pos;
|
||||
Gtid_Slave_Pos
|
||||
0-1-2
|
||||
UPDATE t1 SET a=9 WHERE a=10;
|
||||
UPDATE t1 SET a=10 WHERE a=9;
|
||||
SELECT '0-2-4' AS Gtid_Pos;
|
||||
Gtid_Pos
|
||||
SELECT '0-2-4' AS Gtid_Slave_Pos;
|
||||
Gtid_Slave_Pos
|
||||
0-2-4
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL gtid_pos='0-1-2';
|
||||
ERROR HY000: Requested GTID_POS 0-1-2 conflicts with the binary log which contains a more recent GTID 0-2-4. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog
|
||||
SET GLOBAL gtid_slave_pos='0-1-2';
|
||||
Warnings:
|
||||
Warning 1947 Specified GTID 0-1-2 conflicts with the binary log which contains a more recent GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos.
|
||||
RESET MASTER;
|
||||
SELECT '0-1-2' AS Gtid_Pos;
|
||||
Gtid_Pos
|
||||
SELECT '0-1-2' AS Gtid_Slave_Pos;
|
||||
Gtid_Slave_Pos
|
||||
0-1-2
|
||||
SET GLOBAL gtid_pos='0-1-2';
|
||||
SET GLOBAL gtid_slave_pos='0-1-2';
|
||||
include/start_slave.inc
|
||||
SELECT '0-1-2' AS Gtid_Pos;
|
||||
Gtid_Pos
|
||||
SELECT '0-1-2' AS Gtid_Slave_Pos;
|
||||
Gtid_Slave_Pos
|
||||
0-1-2
|
||||
DROP TABLE t1;
|
||||
include/rpl_end.inc
|
||||
|
||||
@@ -4,8 +4,8 @@ CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
include/stop_slave.inc
|
||||
Master_Log_File = 'master-bin.000001'
|
||||
Using_Gtid = '0'
|
||||
CHANGE MASTER TO master_use_gtid=1;
|
||||
Using_Gtid = 'No'
|
||||
CHANGE MASTER TO master_use_gtid=current_pos;
|
||||
FLUSH LOGS;
|
||||
include/wait_for_purge.inc "master-bin.000002"
|
||||
show binary logs;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
include/rpl_init.inc [topology=1->2]
|
||||
ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
CREATE FUNCTION extract_gtid(d VARCHAR(100), s VARCHAR(100))
|
||||
RETURNS VARCHAR(100) DETERMINISTIC
|
||||
BEGIN
|
||||
@@ -21,7 +21,7 @@ ERROR HY000: Slave is already running
|
||||
include/stop_slave_io.inc
|
||||
START SLAVE UNTIL master_gtid_pos = "";
|
||||
ERROR HY000: START SLAVE UNTIL master_gtid_pos requires that slave is using GTID
|
||||
CHANGE MASTER TO master_use_gtid=1;
|
||||
CHANGE MASTER TO master_use_gtid=current_pos;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t1 VALUES(2);
|
||||
@@ -46,7 +46,7 @@ a
|
||||
include/stop_slave.inc
|
||||
START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200";
|
||||
include/wait_for_slave_to_start.inc
|
||||
Using_Gtid = '1'
|
||||
Using_Gtid = 'Current_Pos'
|
||||
Until_Condition = 'Gtid'
|
||||
include/stop_slave.inc
|
||||
include/start_slave.inc
|
||||
@@ -168,7 +168,7 @@ a
|
||||
include/stop_slave.inc
|
||||
CREATE TABLE t3 (a INT);
|
||||
DROP TABLE t3;
|
||||
START SLAVE UNTIL master_gtid_pos='1-1-15,0-1-16,2-1-14';
|
||||
START SLAVE UNTIL master_gtid_pos='1-1-15,2-1-14,0-1-16';
|
||||
include/wait_for_slave_to_stop.inc
|
||||
SHOW CREATE TABLE t3;
|
||||
Table Create Table
|
||||
@@ -180,7 +180,7 @@ include/start_slave.inc
|
||||
include/stop_slave.inc
|
||||
RESET SLAVE ALL;
|
||||
RESET MASTER;
|
||||
SET GLOBAL gtid_pos='';
|
||||
SET GLOBAL gtid_slave_pos='';
|
||||
RESET MASTER;
|
||||
INSERT INTO t1 VALUES (10);
|
||||
INSERT INTO t1 VALUES (11);
|
||||
@@ -189,7 +189,7 @@ DELETE FROM t1 WHERE a >= 10;
|
||||
RESET MASTER;
|
||||
INSERT INTO t1 VALUES (10);
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
|
||||
master_user = "root", master_use_gtid = 1;
|
||||
master_user = "root", master_use_gtid = current_pos;
|
||||
START SLAVE UNTIL master_gtid_pos = '0-1-2';
|
||||
include/wait_for_slave_to_start.inc
|
||||
INSERT INTO t1 VALUES (11);
|
||||
|
||||
@@ -3,7 +3,7 @@ include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression('Attempting backtrace');
|
||||
call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
|
||||
ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
flush tables;
|
||||
CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb;
|
||||
insert into t1(a) values(1);
|
||||
|
||||
Reference in New Issue
Block a user