mariadb/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result
2024-02-15 13:53:21 +01:00

167 lines
5.1 KiB
Text

include/master-slave.inc
[connection master]
connection server_2;
call mtr.add_suppression("Timeout waiting for reply of binlog");
# Master server_1 and Slave server_2 initialization ...
connection server_2;
include/stop_slave.inc
connection server_1;
RESET MASTER;
set @@session.gtid_domain_id=10;
set @@global.rpl_semi_sync_master_enabled = 1;
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
connection server_2;
RESET MASTER;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set @@session.gtid_domain_id=20;
set @@global.rpl_semi_sync_slave_enabled = 1;
# a 1948 warning is expected
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-1. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
CHANGE MASTER TO master_use_gtid= slave_pos;
include/start_slave.inc
# server_1 -> server_2 semisync link is set up.
connection server_1;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT default 0) ENGINE=Innodb;
INSERT INTO t1(a) VALUES (1);
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
# Circular configuration server_1 -> server_2 -> server_1 ...
connection server_1;
set @@global.gtid_strict_mode = true;
set @@global.rpl_semi_sync_slave_enabled = 1;
CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root', master_ssl_verify_server_cert=0, master_use_gtid=SLAVE_POS;
include/start_slave.inc
... is done.
## A. no out-of-order gtid error for own transaction made round trip
connection server_2;
set @@global.gtid_strict_mode = true;
set @@global.rpl_semi_sync_master_enabled = 1;
INSERT INTO t1(a) VALUES (2);
include/save_master_gtid.inc
connection server_1;
include/stop_slave.inc
include/start_slave.inc
#
# the successful sync is a required proof
#
include/sync_with_master_gtid.inc
update t1 set b=b+1 where a=2;
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
# Post-execution state check on both servers synchronized with each other
connection server_1;
# ... the gtid states on server_1
SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value
gtid_slave_pos 0-2-1,10-1-3,20-2-1
SHOW VARIABLES LIKE 'gtid_binlog_pos';
Variable_name Value
gtid_binlog_pos 0-2-1,10-1-3,20-2-1
SELECT * from t1;
a b
1 0
2 1
connection server_2;
# The gtid states on server_2 must be equal to ...
SHOW VARIABLES LIKE 'gtid_binlog_pos';
Variable_name Value
gtid_binlog_pos 0-2-1,10-1-3,20-2-1
SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value
gtid_slave_pos 0-2-1,10-1-3,20-2-1
SELECT * from t1;
a b
1 0
2 1
## B. out-of-order gtid error for a "foreign" server-id transaction
connection server_1;
set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 10-2-4");
set @@session.server_id=2;
INSERT INTO t1(a) VALUES (3);
set @@session.server_id=default;
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
INSERT INTO t1(a) VALUES (4);
include/save_master_gtid.inc
connection server_1;
include/wait_for_slave_sql_error.inc [errno=1950]
set sql_slave_skip_counter=1;
include/start_slave.inc
include/sync_with_master_gtid.inc
connection server_2;
set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 20-1-3");
set @@session.server_id=1;
INSERT INTO t1(a) VALUES (5);
set @@session.server_id=default;
include/save_master_gtid.inc
connection server_1;
include/sync_with_master_gtid.inc
INSERT INTO t1(a) VALUES (6);
include/save_master_gtid.inc
connection server_2;
include/wait_for_slave_sql_error.inc [errno=1950]
set sql_slave_skip_counter=1;
include/start_slave.inc
include/sync_with_master_gtid.inc
# Post-execution state check on both servers synchronized with each other
connection server_1;
# ... the gtid states on server_1
SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value
gtid_slave_pos 0-2-1,10-1-5,20-1-3
SHOW VARIABLES LIKE 'gtid_binlog_pos';
Variable_name Value
gtid_binlog_pos 0-2-1,10-1-5,20-1-3
SELECT * from t1;
a b
1 0
2 1
3 0
4 0
5 0
6 0
connection server_2;
include/sync_with_master_gtid.inc
# The gtid states on server_2 must be equal to ...
SHOW VARIABLES LIKE 'gtid_binlog_pos';
Variable_name Value
gtid_binlog_pos 0-2-1,10-1-5,20-1-3
SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value
gtid_slave_pos 0-2-1,10-1-5,20-1-3
SELECT * from t1;
a b
1 0
2 1
3 0
4 0
5 0
6 0
#
# Cleanup
#
connection server_1;
DROP TABLE t1;
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
connection server_1;
include/stop_slave.inc
set @@global.rpl_semi_sync_master_enabled = default;
set @@global.rpl_semi_sync_slave_enabled = default;
set @@global.rpl_semi_sync_master_wait_point=default;
set @@global.gtid_ignore_duplicates = default;
set @@global.gtid_strict_mode = default;
connection server_2;
include/stop_slave.inc
set @@global.gtid_ignore_duplicates = default;
set @@global.rpl_semi_sync_master_enabled = default;
set @@global.rpl_semi_sync_slave_enabled = default;
set @@global.gtid_strict_mode = default;
include/start_slave.inc
include/rpl_end.inc