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>
55 lines
2.2 KiB
Text
55 lines
2.2 KiB
Text
include/master-slave.inc
|
|
[connection master]
|
|
connection slave;
|
|
include/stop_slave.inc
|
|
connection master;
|
|
include/rpl_stop_server.inc [server_number=1]
|
|
include/rpl_start_server.inc [server_number=1]
|
|
connection slave;
|
|
SET SQL_LOG_BIN=0;
|
|
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
|
|
SET SQL_LOG_BIN=1;
|
|
SET @old_engine= @@GLOBAL.default_storage_engine;
|
|
SET GLOBAL default_storage_engine=InnoDB;
|
|
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
|
|
SET GLOBAL slave_parallel_threads=12;
|
|
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
|
|
include/start_slave.inc
|
|
connection master;
|
|
SET SQL_LOG_BIN=0;
|
|
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
|
|
SET SQL_LOG_BIN=1;
|
|
connection slave;
|
|
SELECT @@gtid_slave_pos;
|
|
@@gtid_slave_pos
|
|
0-1-1381
|
|
CHECKSUM TABLE table0_int_autoinc, table0_key_pk_parts_2_int_autoinc, table100_int_autoinc, table100_key_pk_parts_2_int_autoinc, table10_int_autoinc, table10_key_pk_parts_2_int_autoinc, table1_int_autoinc, table1_key_pk_parts_2_int_autoinc, table2_int_autoinc, table2_key_pk_parts_2_int_autoinc;
|
|
Table Checksum
|
|
test.table0_int_autoinc 3623174395
|
|
test.table0_key_pk_parts_2_int_autoinc 2888328157
|
|
test.table100_int_autoinc 3624823809
|
|
test.table100_key_pk_parts_2_int_autoinc 3316583308
|
|
test.table10_int_autoinc 1615053718
|
|
test.table10_key_pk_parts_2_int_autoinc 4147461080
|
|
test.table1_int_autoinc 478809705
|
|
test.table1_key_pk_parts_2_int_autoinc 3032208641
|
|
test.table2_int_autoinc 854763867
|
|
test.table2_key_pk_parts_2_int_autoinc 4231615291
|
|
include/stop_slave.inc
|
|
SET GLOBAL default_storage_engine= @old_engine;
|
|
SET GLOBAL slave_parallel_threads=@old_parallel;
|
|
SET sql_log_bin=0;
|
|
DROP TABLE table0_int_autoinc;
|
|
DROP TABLE table0_key_pk_parts_2_int_autoinc;
|
|
DROP TABLE table100_int_autoinc;
|
|
DROP TABLE table100_key_pk_parts_2_int_autoinc;
|
|
DROP TABLE table10_int_autoinc;
|
|
DROP TABLE table10_key_pk_parts_2_int_autoinc;
|
|
DROP TABLE table1_int_autoinc;
|
|
DROP TABLE table1_key_pk_parts_2_int_autoinc;
|
|
DROP TABLE table2_int_autoinc;
|
|
DROP TABLE table2_key_pk_parts_2_int_autoinc;
|
|
SET sql_log_bin=1;
|
|
include/start_slave.inc
|
|
connection master;
|
|
include/rpl_end.inc
|