1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35570 parallel slave ALTER-SEQUENCE attempted to binlog out-of-order

Since MDEV-31503 fixes ALTER-SEQUENCE might be able to  complete its
work including binlogging before a preceding in binlog-order
transaction. There may not be data dependency between the two
transactions, but there would be
   "an attempt was made to binlog GTID D-S-XYZ which would create an
   out-of-order sequence number"
error in the gtid_strict_mode = ON.

After the preceding transaction started committing, and does it rather
slow, ALTER-SEQUNCE was able to find a time window to complete because
it temporarily releases its link with the waitee parent transaction.
And while having it released it also erroneously executes the binlogging part.

Fixed with restoring the commit dependency on the parent before
ALTER-SEQUNCE takes on binlogging.
This commit is contained in:
Andrei
2025-05-13 17:10:30 +03:00
committed by Andrei Elkin
parent e79aa9ca38
commit 8c817e2d8a
4 changed files with 175 additions and 94 deletions

View File

@@ -128,6 +128,53 @@ SET DEBUG_SYNC = 'now SIGNAL continue_worker';
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed";
#
# MDEV-35570 parallel slave ALTER-SEQUNCE attemted to binlog out-of-order.
# Let two transactions I_1 -> AS_2 where AS_2 depends on a commit parent I_1.
# Under the bug condition AS_2 may complete its work including binlogging
# while I_1 is slowly executing Xid_log_event.
# The test simulate the slowness, AS_2 must defer its completion.
#
--connection slave
--source include/stop_slave.inc
set @saved_mode= @@global.slave_parallel_mode;
set @@global.slave_parallel_mode = conservative;
--source include/start_slave.inc
--connection master
INSERT INTO ti SET a=2;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
# allow to proceed to sync with the 1st following WFPT2SC wait condtion
lock table ti write;
# allow to proceed into commit to sync with the 2nd following WFPC wait condition
--let $saved_dbug= @@GLOBAL.debug_dbug
SET GLOBAL debug_dbug= "+d,halt_past_mark_start_commit";
--connection master
INSERT INTO ti SET a=35570;
ALTER SEQUENCE s2 restart with 1;
--source include/save_master_gtid.inc
--connection slave
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit"
--source include/wait_condition.inc
# the 1st wait release
unlock tables;
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit"
--source include/wait_condition.inc
# the 2nd wait release
SET debug_sync = "now SIGNAL past_mark_continue";
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
SET @@global.slave_parallel_mode = @saved_mode;
--eval SET @@global.debug_dbug = $saved_dbug
--source include/start_slave.inc
# MDEV-31792 Assertion in MDL_context::acquire_lock upon parallel replication of CREATE SEQUENCE
--let $iter = 3