diff options
author | Andrei <andrei.elkin@mariadb.com> | 2023-03-18 21:11:07 +0200 |
---|---|---|
committer | Andrei <andrei.elkin@mariadb.com> | 2023-04-27 22:16:33 +0300 |
commit | 1d29d52afc1b8e64af45e72937c019a19545cbc3 (patch) | |
tree | c821bfd0f1e441ff7001c0be7fba49a5b78915f6 /sql/slave.h | |
parent | f21664414da8c4cf26daf5cad012dc0aca028602 (diff) | |
download | mariadb-git-bb-10.4-andrei.tar.gz |
MDEV-29621: Replica stopped by locks on sequencebb-10.4-andrei
When using binlog_row_image=FULL with sequence table inserts, a
replica can deadlock because it treats full inserts in a sequence as DDL
statements by getting an exclusive lock on the sequence table. It
has been observed that with parallel replication, this exclusive
lock on the sequence table can lead to a deadlock where one
transaction has the exclusive lock and is waiting on a prior
transaction to commit, whereas this prior transaction is waiting on
the MDL lock.
This fix for this is on the master side, to raise FL_DDL
flag on the GTID of a full binlog_row_image INSERT of a sequence table.
This forces the slave to execute the statement serially so a deadlock
cannot happen.
A test verifies the deadlock also to prove it happen on the pre-fixes
slave.
OLD (buggy) -> NEW (fixed) replication is provided.
As the pre-fixes master's full row-image may represent both
SELECT NEXT VALUE and INSERT, in case of a buggy master,
the fixed parallel slave pessimistically waits in either case for
the prior transaction to commit before to take on the
critical part of the event execution.
The waiting exploits a parallel slave's retry mechanism which is
controlled by `@@global.slave_transaction_retries`.
Note that in order to avoid any persistent 'Deadlock found' 2013 error
in OLD -> NEW, `slave_transaction_retries` may need to be set to a
higher than the default value.
START-SLAVE is an effective work-around if this still happens.
Diffstat (limited to 'sql/slave.h')
-rw-r--r-- | sql/slave.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/slave.h b/sql/slave.h index e2bd5cec1b9..02de9135c2a 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -231,7 +231,8 @@ bool show_all_master_info(THD* thd); void show_binlog_info_get_fields(THD *thd, List<Item> *field_list); bool show_binlog_info(THD* thd); bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, - bool (*pred)(const void *), const void *param); + bool (*pred)(const void *), const void *param, + bool maria_master= false); bool rpl_master_erroneous_autoinc(THD* thd); const char *print_slave_db_safe(const char *db); |