mariadb/mysql-test/suite/rpl/r/rpl_xa_gap_lock.result
Brandon Nesterenko 5ab5ff08b0 MDEV-19801: Change defaults for CHANGE MASTER TO so that GTID-based replication is used by default if master supports it
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>
2022-07-26 13:31:27 -06:00

44 lines
1.2 KiB
Text

include/master-slave.inc
[connection master]
connection slave;
SET @saved_innodb_limit_optimistic_insert_debug = @@GLOBAL.innodb_limit_optimistic_insert_debug;
SET @@GLOBAL.innodb_limit_optimistic_insert_debug = 2;
connection master;
CREATE TABLE t1 (
c1 INT NOT NULL,
KEY(c1)
) ENGINE=InnoDB;
CREATE TABLE t2 (
c1 INT NOT NULL,
FOREIGN KEY(c1) REFERENCES t1(c1)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (3), (4);
connection master1;
XA START 'XA1';
INSERT INTO t1 values(2);
XA END 'XA1';
connection master;
XA START 'XA2';
INSERT INTO t2 values(3);
XA END 'XA2';
XA PREPARE 'XA2';
connection master1;
XA PREPARE 'XA1';
XA COMMIT 'XA1';
connection master;
XA COMMIT 'XA2';
include/sync_slave_sql_with_master.inc
include/stop_slave.inc
DROP TABLE t2, t1;
RESET SLAVE;
RESET MASTER;
connection master;
Restore binary log from the master into the slave
include/diff_tables.inc [master:test.t1, slave:test.t1]
include/diff_tables.inc [master:test.t2, slave:test.t2]
DROP TABLE t2, t1;
connection slave;
CHANGE MASTER TO MASTER_LOG_FILE='LOG_FILE', MASTER_LOG_POS=LOG_POS, MASTER_USE_GTID=NO;
SET @@GLOBAL.innodb_limit_optimistic_insert_debug = @saved_innodb_limit_optimistic_insert_debug;
include/start_slave.inc
include/rpl_end.inc