Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # Verify that we do not allow users to modify the mysql.gtid_executed
4 # table explicitly by a XA transaction.
5 #
6 # ==== Implementation ====
7 #
8 # - Start a XA transaction and modify the mysql.gtid_executed
9 # table explicitly.
10 # - Check that the ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE error is caused.
11 # - Check that users can not modify mysql.gtid_executed table explicitly.
12 #
13 # ==== References ====
14 #
15 # Bug#21452916 SILENT FAILURE TO START IF MYSQL.GTIDS_EXECUTED GETS HA_ERR_LOCK_WAIT_TIMEOUT
16 #
17
18 --source include/have_binlog_format_row.inc
19
20 --let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
21
22 CREATE TABLE t1 (a INT);
23
24 --echo #
25 --echo # Verify that inserting gtid into mysql.gtid_executed table
26 --echo # explicitly by a XA transaction causes an error.
27 --echo #
28 XA START '1';
29 INSERT INTO t1 VALUES(1);
30 --error ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE
31 INSERT INTO mysql.gtid_executed VALUES("aaaaaaaa-aaaa-aaaa-aaaa-bug#21452916", 1, 1);
32 XA END '1';
33 XA PREPARE '1';
34 XA COMMIT '1';
35
36 FLUSH LOGS;
37 --echo #
38 --echo # Verify that users can not insert gtid into mysql.gtid_executed
39 --echo # table explicitly by a XA transaction.
40 --echo #
41 --let $assert_text= Table mysql.gtid_executed must not contain row with source_uuid=aaaaaaaa-aaaa-aaaa-aaaa-bug#21452916
42 --let $assert_cond= "[SELECT * FROM mysql.gtid_executed WHERE source_uuid="aaaaaaaa-aaaa-aaaa-aaaa-bug#21452916"]" = ""
43 --source include/assert.inc
44
45
46 --echo #
47 --echo # Verify that updating mysql.gtid_executed table
48 --echo # explicitly by a XA transaction causes an error.
49 --echo #
50 XA START '1';
51 INSERT INTO t1 VALUES(2);
52 --error ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE
53 UPDATE mysql.gtid_executed SET source_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-bug#21452916" WHERE source_uuid = '$master_uuid';
54 XA END '1';
55 XA PREPARE '1';
56 XA COMMIT '1';
57
58 --echo #
59 --echo # Verify that users can not update mysql.gtid_executed
60 --echo # table explicitly by a XA transaction.
61 --echo #
62 --let $assert_text= Table mysql.gtid_executed must not contain row with source_uuid=aaaaaaaa-aaaa-aaaa-aaaa-bug#21452916
63 --let $assert_cond= "[SELECT * FROM mysql.gtid_executed WHERE source_uuid="aaaaaaaa-aaaa-aaaa-aaaa-bug#21452916"]" = ""
64 --source include/assert.inc
65
66 --echo #
67 --echo # Verify that deleting from mysql.gtid_executed table
68 --echo # explicitly by a XA transaction causes an error.
69 --echo #
70 XA START '1';
71 INSERT INTO t1 VALUES(3);
72 --error ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE
73 DELETE FROM mysql.gtid_executed WHERE source_uuid = '$master_uuid';
74 XA END '1';
75 XA PREPARE '1';
76 XA COMMIT '1';
77
78 --echo #
79 --echo # Verify that users can not delete from mysql.gtid_executed
80 --echo # table explicitly by a XA transaction.
81 --echo #
82 --let $assert_text= Table mysql.gtid_executed must contain GTID(s) with source_uuid = master_uuid
83 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE source_uuid = "$master_uuid"]" > 0
84 --source include/assert.inc
85
86 DROP TABLE t1;