-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-12179: Per-engine mysql.gtid_slave_pos table.
Intermediate commit. On server start, look for and read all tables mysql.gtid_slave_pos* to restore the GTID position. Simple test case that moves the data to a new mysql.gtid_slave_pos_innodb table and verifies that the new table is read at server start.
- Loading branch information
Showing
3 changed files
with
216 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
include/rpl_init.inc [topology=1->2] | ||
include/stop_slave.inc | ||
CHANGE MASTER TO master_use_gtid=slave_pos; | ||
include/start_slave.inc | ||
CREATE TABLE t1 (a INT PRIMARY KEY); | ||
INSERT INTO t1 VALUES (1); | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
include/stop_slave.inc | ||
SET sql_log_bin=0; | ||
CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos; | ||
ALTER TABLE mysql.gtid_slave_pos_innodb ENGINE=InnoDB; | ||
INSERT INTO mysql.gtid_slave_pos_innodb SELECT * FROM mysql.gtid_slave_pos; | ||
TRUNCATE mysql.gtid_slave_pos; | ||
SET sql_log_bin=1; | ||
INSERT INTO t1 VALUES (2); | ||
INSERT INTO t1 VALUES (3); | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
2 | ||
3 | ||
include/save_master_gtid.inc | ||
include/sync_with_master_gtid.inc | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
2 | ||
3 | ||
SET sql_log_bin=0; | ||
DROP TABLE mysql.gtid_slave_pos_innodb; | ||
SET sql_log_bin=1; | ||
DROP TABLE t1; | ||
include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--let $rpl_topology=1->2 | ||
--source include/rpl_init.inc | ||
--source include/have_innodb.inc | ||
|
||
--connection server_2 | ||
--source include/stop_slave.inc | ||
CHANGE MASTER TO master_use_gtid=slave_pos; | ||
--source include/start_slave.inc | ||
|
||
--connection server_1 | ||
CREATE TABLE t1 (a INT PRIMARY KEY); | ||
INSERT INTO t1 VALUES (1); | ||
SELECT * FROM t1 ORDER BY a; | ||
--save_master_pos | ||
|
||
--connection server_2 | ||
--sync_with_master | ||
SELECT * FROM t1 ORDER BY a; | ||
--source include/stop_slave.inc | ||
SET sql_log_bin=0; | ||
CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos; | ||
ALTER TABLE mysql.gtid_slave_pos_innodb ENGINE=InnoDB; | ||
INSERT INTO mysql.gtid_slave_pos_innodb SELECT * FROM mysql.gtid_slave_pos; | ||
TRUNCATE mysql.gtid_slave_pos; | ||
SET sql_log_bin=1; | ||
|
||
# Restart the slave mysqld server, and verify that the GTID position is | ||
# read correctly from the new mysql.gtid_slave_pos_innodb table. | ||
|
||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect | ||
wait | ||
EOF | ||
--shutdown_server 30 | ||
--source include/wait_until_disconnected.inc | ||
|
||
--connection server_1 | ||
INSERT INTO t1 VALUES (2); | ||
INSERT INTO t1 VALUES (3); | ||
SELECT * FROM t1 ORDER BY a; | ||
--source include/save_master_gtid.inc | ||
|
||
# Let the slave mysqld server start again. | ||
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect | ||
restart: --skip-slave-start=0 | ||
EOF | ||
|
||
--connection server_2 | ||
--enable_reconnect | ||
--source include/wait_until_connected_again.inc | ||
|
||
--source include/sync_with_master_gtid.inc | ||
SELECT * FROM t1 ORDER BY a; | ||
|
||
|
||
--connection server_2 | ||
SET sql_log_bin=0; | ||
DROP TABLE mysql.gtid_slave_pos_innodb; | ||
SET sql_log_bin=1; | ||
|
||
--connection server_1 | ||
DROP TABLE t1; | ||
|
||
--source include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters