mirror of
https://github.com/MariaDB/server.git
synced 2025-02-09 23:24:11 +01:00
![Brandon Nesterenko](/assets/img/avatar_default.png)
This commit makes replicas crash-safe by default by changing the Using_Gtid value to be Slave_Pos on a fresh slave start and after RESET SLAVE is issued. If the primary server does not support GTIDs (i.e., version < 10), the replica will fall back to Using_Gtid=No on slave start and after RESET SLAVE. The following additional informational messages/warnings are added: 1. When Using_Gtid is automatically changed. That is, if RESET SLAVE reverts Using_Gtid back to Slave_Pos, or Using_Gtid is inferred to No from a CHANGE MASTER TO given with log coordinates without MASTER_USE_GTID. 2. If options are ignored in CHANGE MASTER TO. If CHANGE MASTER TO is given with log coordinates, yet also specifies MASTER_USE_GTID=Slave_Pos, a warning message is given that the log coordinate options are ignored. Additionally, an MTR macro has been added for RESET SLAVE, reset_slave.inc, which provides modes/options for resetting a slave in log coordinate or gtid modes. When in log coordinates mode, the macro will execute CHANGE MASTER TO MASTER_USE_GTID=No after the RESET SLAVE command. When in GTID mode, an extra parameter, reset_slave_keep_gtid_state, can be set to reset or preserve the value of gtid_slave_pos. Reviewed By: =========== Andrei Elkin <andrei.elkin@mariadb.com>
72 lines
2 KiB
Text
72 lines
2 KiB
Text
# This test checks that a slave DOES execute queries originating
|
|
# from itself, if running with --replicate-same-server-id.
|
|
|
|
source include/master-slave.inc;
|
|
|
|
connection slave;
|
|
--source include/stop_slave.inc
|
|
CHANGE MASTER TO MASTER_USE_GTID=NO;
|
|
--source include/start_slave.inc
|
|
|
|
create table t1 (n int);
|
|
reset master;
|
|
# replicate ourselves
|
|
stop slave;
|
|
--source include/wait_for_slave_to_stop.inc
|
|
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
|
eval change master to master_port=$SLAVE_MYPORT;
|
|
start slave;
|
|
--source include/wait_for_slave_to_start.inc
|
|
insert into t1 values (1);
|
|
save_master_pos;
|
|
sync_with_master;
|
|
select * from t1; # check that indeed 2 were inserted
|
|
# We stop the slave before cleaning up otherwise we'll get
|
|
# 'drop table t1' executed twice, so an error in the slave.err
|
|
# (not critical).
|
|
stop slave;
|
|
--source include/wait_for_slave_to_stop.inc
|
|
drop table t1;
|
|
|
|
|
|
#
|
|
# Bug#38934 slave slave until does not work with --replicate-same-server-id
|
|
#
|
|
# Verifying that slave performs all events until the master_log_pos
|
|
# in presense of --replicate-same-server-id the slave is started with.
|
|
|
|
connection master;
|
|
reset master;
|
|
|
|
# setting the until position to correspond to the last position of
|
|
# create table which will make the event executed and the slave sql
|
|
# thread stopped right after that.
|
|
|
|
create table t1(n int);
|
|
let $until_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
|
|
dec $until_pos;
|
|
create table t2(n int);
|
|
|
|
connection slave;
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
|
eval change master to master_port=$MASTER_MYPORT;
|
|
--replace_result $until_pos UNTIL_POS
|
|
eval start slave until master_log_file='master-bin.000001', master_log_pos=$until_pos;
|
|
--source include/wait_for_slave_io_to_start.inc
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
|
|
|
--echo *** checking until position execution: must be only t1 in the list ***
|
|
show tables;
|
|
|
|
# cleanup
|
|
|
|
connection slave;
|
|
start slave sql_thread;
|
|
|
|
connection master;
|
|
drop table t1;
|
|
drop table t2;
|
|
sync_slave_with_master;
|
|
|
|
# End of tests
|
|
--source include/rpl_end.inc
|