1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-12179: Per-engine mysql.gtid_slave_pos table

Intermediate commit.

Move the discovery of mysql.gtid_slave_pos* tables into the SQL thread.

This avoids doing things like opening tables and scanning the mysql
schema for tables inside of the START SLAVE statement, which might
interact badly with existing transaction or table locks.

(Even though START SLAVE is documented to implicitly commit any active
transactions, this appears not to be the case in current code).

Table discovery fits naturally in the SQL thread init code, next to
the loading of mysql.gtid_slave_pos state.
This commit is contained in:
Kristian Nielsen
2017-04-23 10:49:58 +02:00
parent 1af3165f98
commit 89aad233de
9 changed files with 63 additions and 33 deletions

View File

@ -10,28 +10,37 @@ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
--connection slave
--source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20);
--error ER_GTID_OPEN_TABLE_FAILED
START SLAVE;
--connection master
INSERT INTO t1 VALUES (1);
--connection slave
CALL mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos");
CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos");
--let $slave_sql_errno=1944
--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 DROP PRIMARY KEY;
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id);
--error ER_GTID_OPEN_TABLE_FAILED
START SLAVE;
--let $slave_sql_errno=1944
--source include/wait_for_slave_sql_error.inc
--source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
--error ER_GTID_OPEN_TABLE_FAILED
START SLAVE;
--let $slave_sql_errno=1944
--source include/wait_for_slave_sql_error.inc
--source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id);
--error ER_GTID_OPEN_TABLE_FAILED
START SLAVE;
--let $slave_sql_errno=1944
--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 ADD PRIMARY KEY (domain_id, sub_id);
--source include/start_slave.inc