mirror of
https://github.com/MariaDB/server.git
synced 2025-11-28 17:36:30 +03:00
There were several cases where the slave GTID position was not loaded correctly before being used. This caused various failures such as corrupting the position at slave start and empty values of @@gtid_slave_pos and @@gtid_current_pos. Fixed by adding more checks for loaded position, and by always loading the position at server startup.
65 lines
2.0 KiB
Plaintext
65 lines
2.0 KiB
Plaintext
include/rpl_init.inc [topology=1->2]
|
|
*** Test normal shutdown/restart of slave server configured as a GTID slave. ***
|
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
|
INSERT INTO t1 VALUES (1);
|
|
include/stop_slave.inc
|
|
Master_Log_File = 'master-bin.000001'
|
|
Using_Gtid = 'No'
|
|
CHANGE MASTER TO master_use_gtid=current_pos;
|
|
FLUSH LOGS;
|
|
include/wait_for_purge.inc "master-bin.000002"
|
|
show binary logs;
|
|
Log_name File_size
|
|
master-bin.000002 #
|
|
INSERT INTO t1 VALUES (2);
|
|
FLUSH LOGS;
|
|
INSERT INTO t1 VALUES (3);
|
|
show binary logs;
|
|
Log_name File_size
|
|
master-bin.000002 #
|
|
master-bin.000003 #
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
*** Test normal shutdown/restart of master server, check binlog state is preserved. ***
|
|
SET SESSION gtid_domain_id= 1;
|
|
INSERT INTO t1 VALUES (4);
|
|
SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000003 # Gtid_list # # [0-1-3]
|
|
FLUSH LOGS;
|
|
SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000004 # Gtid_list # # [1-1-1,0-1-4]
|
|
SHOW BINLOG EVENTS IN 'master-bin.000005' LIMIT 1,1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000005 # Gtid_list # # [1-1-1,0-1-4]
|
|
show binary logs;
|
|
Log_name File_size
|
|
master-bin.000002 #
|
|
master-bin.000003 #
|
|
master-bin.000004 #
|
|
master-bin.000005 #
|
|
INSERT INTO t1 VALUES(5);
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
*** Test that @@gtid_slave_pos and @@gtid_current_pos are correctly loaded even if slave threads have not started. ***
|
|
SET @slave_pos2= @@GLOBAL.gtid_slave_pos;
|
|
SET @current_pos2= @@GLOBAL.gtid_current_pos;
|
|
SELECT IF(@slave_pos1=@slave_pos2, "OK", CONCAT(@slave_pos1, " != ", @slave_pos2));
|
|
IF(@slave_pos1=@slave_pos2, "OK", CONCAT(@slave_pos1, " != ", @slave_pos2))
|
|
OK
|
|
SELECT IF(@current_pos1=@current_pos2, "OK", CONCAT(@current_pos1, " != ", @current_pos2));
|
|
IF(@current_pos1=@current_pos2, "OK", CONCAT(@current_pos1, " != ", @current_pos2))
|
|
OK
|
|
include/start_slave.inc
|
|
DROP TABLE t1;
|
|
include/rpl_end.inc
|