Debian Codegraph @

mysql-test/suite/binlog/t/binlog_xa_handling.test

raw
1 ###############################################################################
2 # Bug#19928622: ASSERTION `! IS_SET()' FAILED. | ABORT IN
3 # DIAGNOSTICS_AREA::SET_OK_STATUS
4 #
5 # Test:
6 # =====
7 # Begin an XA transaction and execte a DML statement so that XA state becomes
8 # XA_ACTIVE. Execute the BINLOG command it should not cause any assert.
9 # Execution should fail and a `ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION` should
10 # be expected.
11 ###############################################################################
12 --source include/have_log_bin.inc
13 CALL mtr.add_suppression("Statement is unsafe because it is being used inside a XA transaction");
14
15 --connection default
16 CREATE TABLE t1(f1 int);
17
18 XA START'','';
19 --disable_warnings
20 INSERT INTO t1 VALUES(10);
21 --enable_warnings
22 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
23 BINLOG '
24 SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
25 AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
26 XA END'';
27 XA PREPARE'';
28 XA COMMIT'';
29
30 #
31 # Bug#21942487 ASSERTION
32 # `STATIC_CAST<SQL_CMD_XA_COMMIT*>(THD->LEX->M_SQL_CMDQL_CMD)->
33 # GET_XA_OPT()
34 # Bug #24764800 REPLICATION FAILING ON SLAVE WITH XAER_RMFAIL ERROR
35 #
36 # The following block checks safety of processing of load masquaraded
37 # as if it's out of mysqlbinlog. The XA transaction must complete in
38 # either rollback or commit mode.
39 # Rollback is done two ways: explicit and implicit through connection close.
40 #
41 SET @sav.pseudo_replica_mode= @@session.pseudo_replica_mode;
42 SELECT @@session.pseudo_replica_mode;
43 # A warning out of the following query is improper and caused by a combination
44 # of the above BINLOG processing and side effect of BUG#15891524.
45 SET @@session.pseudo_replica_mode=1;
46
47 # In order to simulate dressing up as the binlog applier the current connection needs
48 # to process at least one BINLOG carrying Format-Descriptor log-event.
49 BINLOG '
50 SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
51 AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
52
53 SET @@gtid_next = "AUTOMATIC";
54 XA START 'xa_rollback';
55 --disable_warnings
56 INSERT INTO t1 VALUES(10);
57 --enable_warnings
58 XA END 'xa_rollback';
59 XA ROLLBACK 'xa_rollback';
60
61 #
62 # The same but XA END as above in a new connection which is closed to rollback xa
63 #
64 --connect(con1,localhost,root,,)
65 SET @@session.pseudo_replica_mode=1;
66 BINLOG '
67 SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
68 AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
69
70 SET @@gtid_next = "AUTOMATIC";
71 XA START 'xa_disconnect';
72 --disable_warnings
73 INSERT INTO t1 VALUES(10);
74 --enable_warnings
75 --disconnect con1
76
77 --connection default
78 XA START 'xa_commit';
79 --disable_warnings
80 INSERT INTO t1 VALUES(10);
81 --enable_warnings
82 XA END 'xa_commit';
83 XA PREPARE 'xa_commit';
84 XA COMMIT 'xa_commit';
85 SET @@session.pseudo_replica_mode= @sav.pseudo_replica_mode;
86
87 DROP TABLE t1;
88
89 #
90 # BUG#21053526 XA:'XA COMMIT..ONE PHASE' IS BINLOGGED INCORRECTLY AS 'XA PREPARE'
91 #
92
93 #
94 # This is actually the following test:
95 # SEQUENCE: XA BEGIN, XA END, XA COMMIT ONE PHASE
96 #
97 # The test validates that SHOW BINLOG EVENTS shows
98 # the correct info for the ONE PHASE statement
99 #
100 # This test does not test applying the output of
101 # mysqlbinlog, since that is already tested in
102 # mysql-test/extra/binlog_tests/binlog_xa_prepared.test
103 #
104
105 # clean up binary log so that the following operation
106 # does not have to scan through a long history of
107 # events in the log (potentially causing a failure).
108 RESET MASTER;
109
110 CREATE TABLE t1 (c1 INT);
111 XA BEGIN 'xa1';
112 --disable_warnings
113 INSERT INTO t1 VALUES (1);
114 --enable_warnings
115 XA END 'xa1';
116 XA COMMIT 'xa1' ONE PHASE;
117
118 --echo [Validate that SHOW BINLOG EVENTS shows the ONE PHASE statement.]
119 --let $wait_binlog_event= ONE PHASE
120 --source include/wait_for_binlog_event.inc
121
122 DROP TABLE t1;
123
124 # clean up the binary log at in the end of the test
125 # case as well.
126 RESET MASTER;