mariadb/mysql-test/suite/rpl
Monty 9d53fbef7c MMDEV-19749 MDL scalability regression after backup locks
The MDL_BACKUP_COMMIT lock used in handler.cc:ha_commit_trans() that is
used to block commits as part of FLUSH TABLES WITH READ LOCK and BACKUP
STAGE BLOCK_COMMIT can have a notable performance impact
We need the commit block to be able to ensure consistent backups.

The purpose of this commit is to instead of taking an expensive MDL lock,
to protect each commit for a unlikely backup or FTWRL, we would instead
add markers to threads that are doing a commit and when BLOCK_COMMIT or
a FTWRL lock is used we would do slightly more work to ensure that all
threads are taking MDL locks before taking the requested lock.

When backup and FTRWL are not running we are now incrementing a global
variable and setting a marker in the THD to signal that the thread is
in the 'protected commit code block'.

When FTWRL or BACKUP STAGE START is executed we enable MDL locking for
commits and wait until all threads are outside of the protected block
before continuing.
When FTWRL and BACKUP STAGE end, we mark that MDL protecting is not
anymore needed.

The effect is that we change a MDL lock to two atomic increments and
two memory assignments and one extra if. This speeds up commits
but causes FTWRL and BACKUP STAGE START to be slower to start as
they have to wait for active commits to complete.

Most of the new logic can be found in the functions:
enable_backup_commit_locks(), protect_against_backup() and
unprotect_against_backup().

Other things:
- The changes in the tests where because BACKUP STAGE START will now
  block if there are threads inside the 'protected commit block'.
  Before we waited in the test for BACKUP STAGE BLOCK COMMIT. I have
  now changed the tests to either wait for BACKUP STAGE START or by
  doing BACKUP STAGE START early and wait for BACKUP STAGE COMMIT.
- Added MDL_request mdl_backup to THD to avoid initializing a new
  MDL_request for each commit and to simplify some code.
  This added 448 bytes to the THD.
2025-04-11 07:41:58 +03:00
..
extension mtr: use env for perl 2020-06-23 03:24:46 +02:00
include Merge 10.6 -> 10.11 2024-12-05 10:11:58 +01:00
r MMDEV-19749 MDL scalability regression after backup locks 2025-04-11 07:41:58 +03:00
t MMDEV-19749 MDL scalability regression after backup locks 2025-04-11 07:41:58 +03:00
disabled.def Fix RPL tests post DEBUG_SYNC change 2023-02-10 14:44:45 +02:00
my.cnf Remove duplicated default client include from replication my.cnf 2023-09-14 12:56:41 +02:00
README
rpl_1slave_base.cnf

How to run.
===========

./mysql-test-run.pl --suite=rpl --mysqld=--binlog-format=mixed