mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix accumulation of old rows in mysql.gtid_slave_pos
This would happen especially in optimistic parallel replication, where there is a good chance that a transaction will be rolled back (due to conflicts) after it has executed record_gtid(). If the transaction did any deletions of old rows as part of record_gtid(), those deletions will be undone as well. And the code did not properly ensure that the deletions would be re-tried. This patch makes record_gtid() remember the list of deletions done as part of a transaction. Then in rpl_slave_state::update() when the changes have been committed, we discard the list. However, in case of error and rollback, in cleanup_context() we will instead put the list back into rpl_global_gtid_slave_state so that the deletions will be re-tried later. Probably fixes part of the cause of MDEV-12147 as well. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
@ -549,5 +549,22 @@ SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
|
||||
--connection server_1
|
||||
DROP TABLE t1, t2, t3;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2
|
||||
--source include/sync_with_master_gtid.inc
|
||||
# Check for left-over rows in table mysql.gtid_slave_pos (MDEV-12147).
|
||||
#
|
||||
# There was a bug when a transaction got a conflict and was rolled back. It
|
||||
# might have also handled deletion of some old rows, and these deletions would
|
||||
# then also be rolled back. And since the deletes were never re-tried, old no
|
||||
# longer needed rows would accumulate in the table without limit.
|
||||
#
|
||||
# The earlier part of this test file have plenty of transactions being rolled
|
||||
# back. But the last DROP TABLE statement runs on its own and should never
|
||||
# conflict, thus at this point the mysql.gtid_slave_pos table should be clean.
|
||||
--echo Check that no more than the expected last two GTIDs are in mysql.gtid_slave_pos
|
||||
select count(*) from mysql.gtid_slave_pos order by domain_id, sub_id;
|
||||
|
||||
--connection server_1
|
||||
--source include/rpl_end.inc
|
||||
|
Reference in New Issue
Block a user