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

MDEV-10356: rpl.rpl_parallel_temptable failure due to incorrect commit optimization of temptables

The problem was that parallel replication of temporary tables using
statement-based binlogging could overlap the COMMIT in one thread with a DML
or DROP TEMPORARY TABLE in another thread using the same temporary table.
Temporary tables are not safe for concurrent access, so this caused
reference to freed memory and possibly other nastiness.

The fix is to disable the optimisation with overlapping commits of one
transaction with the start of a later transaction, when temporary tables are
in use. Then the following event groups will be blocked from starting until
the one using temporary tables is completed.

This also fixes occasional test failures of rpl.rpl_parallel_temptable seen
in Buildbot.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2023-09-07 13:39:28 +02:00
parent d762e9d943
commit e937a64d46
3 changed files with 34 additions and 1 deletions

View File

@ -2142,6 +2142,19 @@ struct wait_for_commit
group commit as T1.
*/
bool commit_started;
/*
Set to temporarily ignore calls to wakeup_subsequent_commits(). The
caller must arrange that another wakeup_subsequent_commits() gets called
later after wakeup_blocked has been set back to false.
This is used for parallel replication with temporary tables.
Temporary tables require strict single-threaded operation. The normal
optimization, of doing wakeup_subsequent_commits early and overlapping
part of the commit with the following transaction, is not safe. Thus
when temporary tables are replicated, wakeup is blocked until the
event group is fully done.
*/
bool wakeup_blocked;
void register_wait_for_prior_commit(wait_for_commit *waitee);
int wait_for_prior_commit(THD *thd, bool allow_kill=true)