mirror of
https://github.com/MariaDB/server.git
synced 2025-12-12 08:01:43 +03:00
Replicated transaction extra gtid statement on slave failed to specify an engine gtid_slave_pos name correctly. In case lower-case-table-names > 0 the InnoDB table name was generated to reproduce the lower-case-table-names=0 version which is of mixed cases. In rpl.rpl_mdev12179 test run this triggered a failure to DROP table which was due to the innodb table handle was not closed: InnoDB: Waited XYZ seconds for ref-count on table: `mysql`.`gtid_slave_pos_innodb` on windows. The closing issue was caused by having the table registered twice in the table cache, for its lower- and mixed- case name versions. The DROP-table handler closed only only one of the cache item to leave the 2nd one active. (On Linux a failure occurs earlier at attempt to open an expected lower-cased table: Last_Error: Error during XID COMMIT: failed to update GTID state in mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos_InnoDB' doesn't exist but the table's name as the message shows is not in the right case). Fixed with consulting lower-case-table-names when the engine gtid-slave-pos table is created. Note the lower-case-table-names=a-value created table will not recognized when next the lower case option changes to a different value. In 10.4 a follow-up patch is going to lowercase gtid-slave-pos autocreated table at once at their origination, and a warning is issued in the 10.3 current patch.
276 lines
6.3 KiB
Plaintext
276 lines
6.3 KiB
Plaintext
include/rpl_init.inc [topology=1->2]
|
|
connection server_2;
|
|
call mtr.add_suppression("The automatically created table.*name may not be entirely in lowercase");
|
|
SET GLOBAL gtid_pos_auto_engines="innodb";
|
|
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
|
|
include/stop_slave.inc
|
|
CHANGE MASTER TO master_use_gtid=slave_pos;
|
|
SELECT @@gtid_pos_auto_engines;
|
|
@@gtid_pos_auto_engines
|
|
|
|
SELECT @@SESSION.gtid_pos_auto_engines;
|
|
ERROR HY000: Variable 'gtid_pos_auto_engines' is a GLOBAL variable
|
|
SET GLOBAL gtid_pos_auto_engines= NULL;
|
|
ERROR 42000: Variable 'gtid_pos_auto_engines' can't be set to the value of 'NULL'
|
|
SET GLOBAL gtid_pos_auto_engines="innodb";
|
|
SELECT @@gtid_pos_auto_engines;
|
|
@@gtid_pos_auto_engines
|
|
InnoDB
|
|
SET GLOBAL gtid_pos_auto_engines="myisam,innodb";
|
|
SELECT @@gtid_pos_auto_engines;
|
|
@@gtid_pos_auto_engines
|
|
MyISAM,InnoDB
|
|
SET GLOBAL gtid_pos_auto_engines="innodb,myisam";
|
|
SELECT @@gtid_pos_auto_engines;
|
|
@@gtid_pos_auto_engines
|
|
InnoDB,MyISAM
|
|
SET GLOBAL gtid_pos_auto_engines="innodb,innodb,myisam,innodb,myisam,myisam,innodb";
|
|
SELECT @@gtid_pos_auto_engines;
|
|
@@gtid_pos_auto_engines
|
|
InnoDB,MyISAM
|
|
SET GLOBAL gtid_pos_auto_engines=DEFAULT;
|
|
SELECT @@gtid_pos_auto_engines;
|
|
@@gtid_pos_auto_engines
|
|
|
|
SET GLOBAL gtid_pos_auto_engines="";
|
|
SELECT @@gtid_pos_auto_engines;
|
|
@@gtid_pos_auto_engines
|
|
|
|
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;
|
|
a
|
|
1
|
|
connection server_2;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
include/stop_slave.inc
|
|
SET sql_log_bin=0;
|
|
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
|
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;
|
|
connection server_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
|
|
*** Restart server with --gtid-pos-auto-engines=innodb,myisam ***
|
|
connection server_2;
|
|
include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
*** Verify no new gtid_slave_pos* tables are created ***
|
|
SELECT table_name, engine FROM information_schema.tables
|
|
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
|
ORDER BY table_name;
|
|
table_name engine
|
|
gtid_slave_pos MyISAM
|
|
gtid_slave_pos_innodb InnoDB
|
|
SELECT @@gtid_pos_auto_engines;
|
|
@@gtid_pos_auto_engines
|
|
InnoDB,MyISAM
|
|
include/stop_slave.inc
|
|
SET sql_log_bin=0;
|
|
INSERT INTO mysql.gtid_slave_pos_innodb SELECT * FROM mysql.gtid_slave_pos;
|
|
DROP TABLE mysql.gtid_slave_pos;
|
|
RENAME TABLE mysql.gtid_slave_pos_innodb TO mysql.gtid_slave_pos;
|
|
SET sql_log_bin=1;
|
|
connection server_1;
|
|
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (4);
|
|
INSERT INTO t2 VALUES (1);
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
include/save_master_gtid.inc
|
|
*** Restart server with --gtid-pos-auto-engines=myisam,innodb ***
|
|
connection server_2;
|
|
include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
*** Verify that no new gtid_slave_pos* tables are auto-created ***
|
|
SELECT table_name, engine FROM information_schema.tables
|
|
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
|
ORDER BY table_name;
|
|
table_name engine
|
|
gtid_slave_pos InnoDB
|
|
include/stop_slave.inc
|
|
SET sql_log_bin=0;
|
|
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
|
|
SET sql_log_bin=1;
|
|
connection server_1;
|
|
INSERT INTO t1 VALUES (5);
|
|
INSERT INTO t2 VALUES (2);
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
include/save_master_gtid.inc
|
|
connection server_2;
|
|
include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
*** Verify that mysql.gtid_slave_pos_InnoDB is auto-created ***
|
|
SELECT lower(table_name), engine FROM information_schema.tables
|
|
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
|
ORDER BY table_name;
|
|
lower(table_name) engine
|
|
gtid_slave_pos MyISAM
|
|
gtid_slave_pos_innodb InnoDB
|
|
include/stop_slave.inc
|
|
SET sql_log_bin=0;
|
|
INSERT INTO mysql.gtid_slave_pos SELECT * FROM mysql.gtid_slave_pos_InnoDB;
|
|
DROP TABLE mysql.gtid_slave_pos_InnoDB;
|
|
SET sql_log_bin=1;
|
|
connection server_1;
|
|
INSERT INTO t1 VALUES (6);
|
|
INSERT INTO t2 VALUES (3);
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
include/save_master_gtid.inc
|
|
*** Restart server without --gtid-pos-auto-engines ***
|
|
connection server_2;
|
|
include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
*** Verify that no mysql.gtid_slave_pos* table is auto-created ***
|
|
SELECT table_name, engine FROM information_schema.tables
|
|
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
|
ORDER BY table_name;
|
|
table_name engine
|
|
gtid_slave_pos MyISAM
|
|
SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos GROUP BY domain_id;
|
|
domain_id max(seq_no)
|
|
0 11
|
|
include/stop_slave.inc
|
|
SET GLOBAL gtid_pos_auto_engines="innodb";
|
|
include/start_slave.inc
|
|
connection server_1;
|
|
INSERT INTO t1 VALUES (7);
|
|
INSERT INTO t2 VALUES (4);
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
include/save_master_gtid.inc
|
|
connection server_2;
|
|
include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
*** Verify that mysql.gtid_slave_pos_InnoDB is auto-created ***
|
|
SELECT lower(table_name), engine FROM information_schema.tables
|
|
WHERE table_schema='mysql' AND table_name LIKE 'gtid_slave_pos%'
|
|
ORDER BY table_name;
|
|
lower(table_name) engine
|
|
gtid_slave_pos MyISAM
|
|
gtid_slave_pos_innodb InnoDB
|
|
SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos GROUP BY domain_id;
|
|
domain_id max(seq_no)
|
|
0 13
|
|
connection server_2;
|
|
*** Restart the slave server to prove 'gtid_slave_pos_innodb' autodiscovery ***
|
|
connection server_2;
|
|
SELECT max(seq_no) FROM mysql.gtid_slave_pos_InnoDB into @seq_no;
|
|
connection server_1;
|
|
INSERT INTO t2(a) SELECT 1+MAX(a) FROM t2;
|
|
include/save_master_gtid.inc
|
|
connection server_2;
|
|
include/sync_with_master_gtid.inc
|
|
include/stop_slave.inc
|
|
SET GLOBAL gtid_pos_auto_engines="";
|
|
SET sql_log_bin=0;
|
|
DROP TABLE mysql.gtid_slave_pos_InnoDB;
|
|
SET sql_log_bin=1;
|
|
include/start_slave.inc
|
|
connection server_1;
|
|
DROP TABLE t1, t2;
|
|
include/rpl_end.inc
|