1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

q# This is a combination of 2 commits.

MDEV-31503 ALTER SEQUENCE ends up in optimistic parallel slave binlog out-of-order

The OOO error still was possible even after MDEV-31077. This time
it occured through open_table() when the sequence table was not in
the table cache *and* the table was created before the last server
restart.
In such context a internal (read-only) transaction is committed
and it was not blocked from doing a wakeup() call to subsequent
transactions.

Fixed with extending suspend_subsequent_commits() effect for the entirety
of Sql_cmd_alter_sequence::execute().
An elaborated MDEV-31077 test proves the fixes of both failure scenarios.

Also the bug condition suggests a workaround to pre-SELECT sequence
tables before START SLAVE.

Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
This commit is contained in:
Andrei
2023-07-05 19:01:13 +03:00
parent 3f5cee8f54
commit 7dde504aef
3 changed files with 58 additions and 17 deletions

View File

@ -47,11 +47,21 @@ Warnings:
Note 1255 Slave already has been stopped
RESET MASTER;
SET @@global.gtid_slave_pos="";
SET @@global.gtid_strict_mode=1;
connection master;
RESET MASTER;
CREATE TABLE ti (a INT) ENGINE=innodb;
CREATE SEQUENCE s2 ENGINE=innodb;
include/save_master_gtid.inc
connection slave;
include/start_slave.inc
include/sync_with_master_gtid.inc
include/stop_slave.inc
include/rpl_restart_server.inc [server_number=2]
SET @@global.slave_parallel_threads=2;
SET @@global.slave_parallel_mode=optimistic;
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
SET @@global.gtid_strict_mode=1;
connection master;
SET @@gtid_seq_no=100;
ALTER SEQUENCE s2 restart with 1;
INSERT INTO ti SET a=1;
@ -60,6 +70,7 @@ SELECT @@global.gtid_binlog_state "Master gtid state";
Master gtid state
0-1-101
connection slave;
SET STATEMENT sql_log_bin=0 FOR FLUSH TABLES;
include/start_slave.inc
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both";
@@global.gtid_binlog_state no 100,101 yet in both