MINI MINI MANI MO
# ==== Purpose ====
#
# If a server is crashed after preparing a XA transaction and right before
# committing the XA transaction, which is used to select from the system
# gtid_executed table explicitly by users, verify that the following
# recovery is not aborting due to an innodb_lock_wait_timeout error
# when it is reading the system gtid_executed table.
#
# ==== Implementation ====
#
# - Start a XA transaction and select from the mysql.gtid_executed
# table explicitly.
# - Check the ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE error is not caused.
# - Crash the server after preparing a XA transaction and right before
# committing the XA transaction.
# - Verify that the following recovery is not aborting due to an
# innodb_lock_wait_timeout error when it is reading the system
# gtid_executed table.
#
# ==== References ====
#
# Bug#21452916 SILENT FAILURE TO START IF MYSQL.GTIDS_EXECUTED GETS HA_ERR_LOCK_WAIT_TIMEOUT
#
# Make sure the test is repeatable
--source include/force_restart.inc
--source include/not_valgrind.inc
--source include/have_binlog_format_row.inc
--source include/have_debug.inc
--source include/have_gtid.inc
call mtr.add_suppression("Found 1 prepared XA transactions");
# For reseting mysql.gtid_executed table
RESET MASTER;
--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
FLUSH LOGS;
--echo #
--echo # Verify that selecting from mysql.gtid_executed table
--echo # explicitly by a XA transaction does not cause an error.
--echo #
XA START '1';
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
--replace_result $master_uuid MASTER_UUID
SELECT * FROM mysql.gtid_executed;
XA END '1';
XA PREPARE '1';
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--echo #
--echo # Crash the server after preparing a XA transaction
--echo # and right before committing the XA transaction
--echo #
SET @@SESSION.DEBUG= '+d, simulate_crash_on_commit_xa_trx';
# Run the crashing query with the CR_SERVER_LOST error
--error 2013
XA COMMIT '1';
--echo #
--echo # Verify that the following recovery is not aborting due to an
--echo # innodb_lock_wait_timeout error when it is reading the system
--echo # gtid_executed table.
--echo #
--source include/wait_until_disconnected.inc
--enable_reconnect
--echo # Restart the master server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--disable_reconnect
DROP TABLE t1;
OHA YOOOO