mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-12179: Per-engine mysql.gtid_slave_pos table
Intermediate commit. Update some existing test cases to work with the new handling of mysql.gtid_slave_pos* tables: - The tables are now checked during START SLAVE, which causes some errors or error injections to trigger differently. - Some test cases that play games with renaming or altering the mysql.gtid_slave_pos table need adjustments.
This commit is contained in:
@@ -88,16 +88,16 @@ include/save_master_gtid.inc
|
|||||||
connection server_2;
|
connection server_2;
|
||||||
include/sync_with_master_gtid.inc
|
include/sync_with_master_gtid.inc
|
||||||
include/stop_slave.inc
|
include/stop_slave.inc
|
||||||
SET GLOBAL debug_dbug="+d,crash_commit_before";
|
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
|
SET GLOBAL debug_dbug="+d,crash_commit_before";
|
||||||
connection server_1;
|
connection server_1;
|
||||||
INSERT INTO t1 VALUES (5);
|
INSERT INTO t1 VALUES (5);
|
||||||
include/save_master_gtid.inc
|
include/save_master_gtid.inc
|
||||||
connection server_2;
|
connection server_2;
|
||||||
include/sync_with_master_gtid.inc
|
include/sync_with_master_gtid.inc
|
||||||
include/stop_slave.inc
|
include/stop_slave.inc
|
||||||
SET GLOBAL debug_dbug="+d,crash_commit_after";
|
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
|
SET GLOBAL debug_dbug="+d,crash_commit_after";
|
||||||
connection server_1;
|
connection server_1;
|
||||||
INSERT INTO t1 VALUES (6);
|
INSERT INTO t1 VALUES (6);
|
||||||
include/save_master_gtid.inc
|
include/save_master_gtid.inc
|
||||||
|
@@ -8,26 +8,22 @@ connection slave;
|
|||||||
include/stop_slave.inc
|
include/stop_slave.inc
|
||||||
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20);
|
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20);
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
|
ERROR HY000: Failed to open mysql.gtid_slave_pos
|
||||||
connection master;
|
connection master;
|
||||||
INSERT INTO t1 VALUES (1);
|
INSERT INTO t1 VALUES (1);
|
||||||
connection slave;
|
connection slave;
|
||||||
CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos");
|
CALL mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos");
|
||||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
|
||||||
include/stop_slave.inc
|
|
||||||
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
|
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
|
||||||
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
||||||
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id);
|
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id);
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
ERROR HY000: Failed to open mysql.gtid_slave_pos
|
||||||
include/stop_slave.inc
|
|
||||||
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
ERROR HY000: Failed to open mysql.gtid_slave_pos
|
||||||
include/stop_slave.inc
|
|
||||||
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id);
|
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id);
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
include/wait_for_slave_sql_error.inc [errno=1942]
|
ERROR HY000: Failed to open mysql.gtid_slave_pos
|
||||||
include/stop_slave.inc
|
|
||||||
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
||||||
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id);
|
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id);
|
||||||
include/start_slave.inc
|
include/start_slave.inc
|
||||||
|
@@ -194,7 +194,7 @@ domain_id COUNT(*)
|
|||||||
*** MDEV-4650: show variables; ERROR 1946 (HY000): Failed to load replication slave GTID position ***
|
*** MDEV-4650: show variables; ERROR 1946 (HY000): Failed to load replication slave GTID position ***
|
||||||
connection server_2;
|
connection server_2;
|
||||||
SET sql_log_bin=0;
|
SET sql_log_bin=0;
|
||||||
RENAME TABLE mysql.gtid_slave_pos TO mysql.gtid_slave_pos_old;
|
RENAME TABLE mysql.gtid_slave_pos TO mysql.old_gtid_slave_pos;
|
||||||
SET sql_log_bin=1;
|
SET sql_log_bin=1;
|
||||||
SHOW VARIABLES;
|
SHOW VARIABLES;
|
||||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||||
@@ -207,7 +207,7 @@ Level Code Message
|
|||||||
Error 1146 Table 'mysql.gtid_slave_pos' doesn't exist
|
Error 1146 Table 'mysql.gtid_slave_pos' doesn't exist
|
||||||
Error 1946 Failed to load replication slave GTID position from table mysql.gtid_slave_pos
|
Error 1946 Failed to load replication slave GTID position from table mysql.gtid_slave_pos
|
||||||
SET sql_log_bin=0;
|
SET sql_log_bin=0;
|
||||||
RENAME TABLE mysql.gtid_slave_pos_old TO mysql.gtid_slave_pos;
|
RENAME TABLE mysql.old_gtid_slave_pos TO mysql.gtid_slave_pos;
|
||||||
CALL mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
|
CALL mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
|
||||||
SET sql_log_bin=1;
|
SET sql_log_bin=1;
|
||||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||||
|
@@ -10,6 +10,8 @@ SET s= SUBSTR(s FROM 1 FOR LOCATE(",", s) - 1);
|
|||||||
RETURN s;
|
RETURN s;
|
||||||
END|
|
END|
|
||||||
connection server_2;
|
connection server_2;
|
||||||
|
include/stop_slave.inc
|
||||||
|
include/start_slave.inc
|
||||||
START SLAVE UNTIL master_gtid_pos = "";
|
START SLAVE UNTIL master_gtid_pos = "";
|
||||||
ERROR HY000: Slave is already running
|
ERROR HY000: Slave is already running
|
||||||
include/stop_slave_io.inc
|
include/stop_slave_io.inc
|
||||||
|
@@ -161,8 +161,8 @@ EOF
|
|||||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
||||||
wait
|
wait
|
||||||
EOF
|
EOF
|
||||||
SET GLOBAL debug_dbug="+d,crash_commit_before";
|
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
|
SET GLOBAL debug_dbug="+d,crash_commit_before";
|
||||||
|
|
||||||
--connection server_1
|
--connection server_1
|
||||||
INSERT INTO t1 VALUES (5);
|
INSERT INTO t1 VALUES (5);
|
||||||
@@ -185,8 +185,8 @@ EOF
|
|||||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
||||||
wait
|
wait
|
||||||
EOF
|
EOF
|
||||||
SET GLOBAL debug_dbug="+d,crash_commit_after";
|
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
|
SET GLOBAL debug_dbug="+d,crash_commit_after";
|
||||||
|
|
||||||
--connection server_1
|
--connection server_1
|
||||||
INSERT INTO t1 VALUES (6);
|
INSERT INTO t1 VALUES (6);
|
||||||
|
@@ -10,37 +10,28 @@ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|||||||
--connection slave
|
--connection slave
|
||||||
--source include/stop_slave.inc
|
--source include/stop_slave.inc
|
||||||
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20);
|
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20);
|
||||||
|
--error ER_GTID_OPEN_TABLE_FAILED
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
|
|
||||||
--connection master
|
--connection master
|
||||||
INSERT INTO t1 VALUES (1);
|
INSERT INTO t1 VALUES (1);
|
||||||
|
|
||||||
--connection slave
|
--connection slave
|
||||||
CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos");
|
CALL mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos");
|
||||||
--let $slave_sql_errno=1942
|
|
||||||
--source include/wait_for_slave_sql_error.inc
|
|
||||||
|
|
||||||
--source include/stop_slave.inc
|
|
||||||
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
|
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
|
||||||
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
||||||
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id);
|
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id);
|
||||||
|
--error ER_GTID_OPEN_TABLE_FAILED
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
--let $slave_sql_errno=1942
|
|
||||||
--source include/wait_for_slave_sql_error.inc
|
|
||||||
|
|
||||||
--source include/stop_slave.inc
|
|
||||||
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
||||||
|
--error ER_GTID_OPEN_TABLE_FAILED
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
--let $slave_sql_errno=1942
|
|
||||||
--source include/wait_for_slave_sql_error.inc
|
|
||||||
|
|
||||||
--source include/stop_slave.inc
|
|
||||||
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id);
|
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id);
|
||||||
|
--error ER_GTID_OPEN_TABLE_FAILED
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
--let $slave_sql_errno=1942
|
|
||||||
--source include/wait_for_slave_sql_error.inc
|
|
||||||
|
|
||||||
--source include/stop_slave.inc
|
|
||||||
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
|
||||||
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id);
|
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id);
|
||||||
--source include/start_slave.inc
|
--source include/start_slave.inc
|
||||||
|
@@ -232,6 +232,20 @@ EOF
|
|||||||
SET sql_log_bin= 0;
|
SET sql_log_bin= 0;
|
||||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
||||||
SET sql_log_bin= 1;
|
SET sql_log_bin= 1;
|
||||||
|
# Do a second restart to get the mysql.gtid_slave_pos table loaded with
|
||||||
|
# the right engine.
|
||||||
|
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
||||||
|
wait
|
||||||
|
EOF
|
||||||
|
--shutdown_server 30
|
||||||
|
--source include/wait_until_disconnected.inc
|
||||||
|
|
||||||
|
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
||||||
|
restart:
|
||||||
|
EOF
|
||||||
|
--enable_reconnect
|
||||||
|
--source include/wait_until_connected_again.inc
|
||||||
|
|
||||||
--source include/start_slave.inc
|
--source include/start_slave.inc
|
||||||
|
|
||||||
--connection server_1
|
--connection server_1
|
||||||
@@ -285,7 +299,7 @@ SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
|
|||||||
--connection server_2
|
--connection server_2
|
||||||
SET sql_log_bin=0;
|
SET sql_log_bin=0;
|
||||||
--let $old_pos= `SELECT @@GLOBAL.gtid_slave_pos`
|
--let $old_pos= `SELECT @@GLOBAL.gtid_slave_pos`
|
||||||
RENAME TABLE mysql.gtid_slave_pos TO mysql.gtid_slave_pos_old;
|
RENAME TABLE mysql.gtid_slave_pos TO mysql.old_gtid_slave_pos;
|
||||||
SET sql_log_bin=1;
|
SET sql_log_bin=1;
|
||||||
|
|
||||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
||||||
@@ -313,7 +327,7 @@ SHOW WARNINGS;
|
|||||||
# Restore things.
|
# Restore things.
|
||||||
|
|
||||||
SET sql_log_bin=0;
|
SET sql_log_bin=0;
|
||||||
RENAME TABLE mysql.gtid_slave_pos_old TO mysql.gtid_slave_pos;
|
RENAME TABLE mysql.old_gtid_slave_pos TO mysql.gtid_slave_pos;
|
||||||
CALL mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
|
CALL mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
|
||||||
SET sql_log_bin=1;
|
SET sql_log_bin=1;
|
||||||
|
|
||||||
|
@@ -19,6 +19,9 @@ delimiter ;|
|
|||||||
|
|
||||||
--connection server_2
|
--connection server_2
|
||||||
--sync_with_master
|
--sync_with_master
|
||||||
|
# Restart SQL thread to pick up ALTER TABLE of mysql.gtid_slave_pos.
|
||||||
|
--source include/stop_slave.inc
|
||||||
|
--source include/start_slave.inc
|
||||||
|
|
||||||
# Both replication threads must be stopped for UNTIL master_gtid_pos.
|
# Both replication threads must be stopped for UNTIL master_gtid_pos.
|
||||||
--error ER_SLAVE_WAS_RUNNING
|
--error ER_SLAVE_WAS_RUNNING
|
||||||
|
Reference in New Issue
Block a user