polardbxengine/mysql-test/suite/xengine_main/t/xa_applier_crash_mdl.test

83 lines
2.6 KiB
Plaintext

#
# WL#9335 : Enable MDL Locking for Recovered and Detached Prepared XA
# Transactions
#
# This test script is added to test replication applier thread's behaviour
# with MDL locks after XA Prepare transaction is detached from the applier
# thread.
#
#
# Steps to reproduce:
#
# 0. Initial setup. Create two connections (applier_thread, xa_commit_thread).
#
# 1. Make a thread as "applier_thread" by setting pseudo_slave_mode and
# by executing BINLOG'' query.
#
# 2. Prepare a XA transaction on applier_thread that involves FTS index.
#
# 3. A 'XA COMMIT' is pending on table t1 which is holding MDL lock.
# Hence executing 'DROP TABLE' on t1 should be blocked by the server.
#
# 4. From a different thread, check that DROP TABLE is waiting for MDL
# lock. Then execute XA COMMIT which releases the MDL lock.
#
# 5. After XA COMMIT (after releasing MDL lock on table t1),
# Drop table should continue and be successful.
#
# 6. Cleanup (disconnect two connections).
#
# References:
# Bug 27995891: CRASH: SEGMENTATION FAULT IN FTS_COMMIT_TABLE() DUE TO NULL FTS.
#
--echo #
--echo # 0. Initial setup. Create two connections (applier_thread, xa_commit_thread).
--echo #
connect (applier_thread,127.0.0.1,root,,test,,);
connect (xa_commit_thread,127.0.0.1,root,,test,,);
--echo #
--echo # 1. Make a thread as "applier_thread" by setting pseudo_slave_mode and
--echo # by executing BINLOG'' query.
--echo #
--connection applier_thread
SET @@SESSION.pseudo_slave_mode=1;
--error ER_BASE64_DECODE_ERROR
BINLOG '0';
--echo #
--echo # 2. Prepare a XA transaction on applier_thread that involves FTS index.
--echo #
CREATE TABLE t1(i TEXT, FULLTEXT INDEX tix (i)) ENGINE=InnoDB;
XA START 'xa1','';
INSERT INTO t1 VALUES ('abc');
XA END 'xa1','';
XA PREPARE 'xa1','';
--echo #
--echo # 3. A 'XA COMMIT' is pending on table t1 which is holding MDL lock.
--echo # Hence executing 'DROP TABLE' on t1 should be blocked by the server.
--send DROP TABLE t1;
--echo #
--echo # 4. From a different thread, check that DROP TABLE is waiting for MDL
--echo # lock. Then execute XA COMMIT which releases the MDL lock.
--echo #
--connection xa_commit_thread
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for table metadata lock" AND INFO = "DROP TABLE t1";
--source include/wait_condition_or_abort.inc
XA COMMIT 'xa1';
--echo #
--echo # 5. After XA COMMIT (after releasing MDL lock on table t1),
--echo # Drop table should continue and be successful.
--echo #
--connection applier_thread
--reap
--echo #
--echo # 6. Cleanup.
--echo #
--disconnect applier_thread
--disconnect xa_commit_thread