Debian Codegraph @

mysql-test/suite/binlog_gtid/t/binlog_xa_select_gtid_executed_explicitly_crash.test

raw
1 # ==== Purpose ====
2 #
3 # If a server is crashed after preparing a XA transaction and right before
4 # committing the XA transaction, which is used to select from the system
5 # gtid_executed table explicitly by users, verify that the following
6 # recovery is not aborting due to an innodb_lock_wait_timeout error
7 # when it is reading the system gtid_executed table.
8 #
9 # ==== Implementation ====
10 #
11 # - Start a XA transaction and select from the mysql.gtid_executed
12 # table explicitly.
13 # - Check the ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE error is not caused.
14 # - Crash the server after preparing a XA transaction and right before
15 # committing the XA transaction.
16 # - Verify that the following recovery is not aborting due to an
17 # innodb_lock_wait_timeout error when it is reading the system
18 # gtid_executed table.
19 #
20 # ==== References ====
21 #
22 # Bug#21452916 SILENT FAILURE TO START IF MYSQL.GTIDS_EXECUTED GETS HA_ERR_LOCK_WAIT_TIMEOUT
23 #
24
25 # Make sure the test is repeatable
26 --source include/force_restart.inc
27 --source include/not_valgrind.inc
28 --source include/have_binlog_format_row.inc
29 --source include/have_debug.inc
30
31 call mtr.add_suppression("Found 1 prepared XA transactions");
32
33 # For reseting mysql.gtid_executed table
34 RESET MASTER;
35
36 --let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
37
38 CREATE TABLE t1 (a INT) ENGINE=InnoDB;
39
40 FLUSH LOGS;
41 --echo #
42 --echo # Verify that selecting from mysql.gtid_executed table
43 --echo # explicitly by a XA transaction does not cause an error.
44 --echo #
45 --connect(con1, localhost, root,,)
46 --connection con1
47 XA START '1';
48 INSERT INTO t1 VALUES(1);
49 INSERT INTO t1 VALUES(2);
50 --replace_result $master_uuid MASTER_UUID
51 SELECT * FROM mysql.gtid_executed;
52 XA END '1';
53 XA PREPARE '1';
54
55 --echo #
56 --echo # Crash the server after preparing a XA transaction
57 --echo # and right before committing the XA transaction
58 --echo #
59 --let $auxiliary_connection = default
60 --let $statement_connection = con1
61 --let $statement = XA COMMIT '1'
62 --let $sync_point = before_commit_xa_trx
63 --source include/execute_to_conditional_timestamp_sync_point.inc
64 --source include/kill_mysqld.inc
65
66 --echo #
67 --echo # Verify that the following recovery is not aborting due to an
68 --echo # innodb_lock_wait_timeout error when it is reading the system
69 --echo # gtid_executed table.
70 --echo #
71 --source include/start_mysqld.inc
72
73 --echo # Rollback the XA transaction with xid '1' in order to release
74 --echo # MDL lock for the table t1 and so allow the statement DROP TABLE t1
75 --echo # to be executed successfully.
76 XA ROLLBACK '1';
77
78 DROP TABLE t1;