mariadb/mysql-test/suite/galera/t/MDEV-33136.test
Denis Protivensky 7bf3c3124a MDEV-33136: Properly BF-abort user transactions with explicit locks
User transactions may acquire explicit MDL locks from InnoDB level
when persistent statistics is re-read for a table.
If such a transaction would be subject to BF-abort, it was improperly
detected as a system transaction and wouldn't get aborted.

The fix: Check if a transaction holding explicit MDL locks is a user
transaction in the MDL conflict handling code.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-03-27 01:25:22 +01:00

44 lines
1.3 KiB
Text

#
# MDEV-33136: Properly BF-abort user transactions with explicit locks
#
# User transactions may acquire explicit MDL locks from InnoDB level
# when persistent statistics is re-read for a table.
# If such a transaction would be subject to BF-abort, it was improperly
# detected as a system transaction and wouldn't get aborted.
#
# The fix: Check if a transaction holding explicit MDL locks is a user
# transaction in the MDL conflict handling code.
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
--source include/have_debug.inc
--connect node_1a,127.0.0.1,root,,test,$NODE_MYPORT_1
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
--connection node_1a
TRUNCATE TABLE t1;
# TRUNCATE forces the next statement to re-read statistics from persistent storage,
# which will acquire MDL locks on the statistics tables in InnoDB.
SET SESSION wsrep_retry_autocommit = 0;
SET DEBUG_SYNC = 'dict_stats_mdl_acquired SIGNAL may_toi WAIT_FOR bf_abort';
--send
INSERT INTO t1 VALUES (1);
--connection node_1
SET DEBUG_SYNC = 'now WAIT_FOR may_toi';
TRUNCATE TABLE t1;
--connection node_1a
# Local INSERT gets aborted.
--error ER_LOCK_DEADLOCK
--reap
# Cleanup
--connection node_1
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
--disconnect node_1a
--source include/galera_end.inc