4
-- source include/have_innodb.inc
6
--source include/not_embedded.inc
8
# Save the initial number of concurrent sessions
9
--source include/count_sessions.inc
12
drop table if exists t1, t2;
14
create table t1 (a int) engine=innodb;
16
insert t1 values (10);
23
--error ER_XAER_RMFAIL
25
insert t1 values (20);
26
--error ER_XAER_RMFAIL
33
xa start 'testa','testb';
34
insert t1 values (30);
36
--error ER_XAER_RMFAIL
39
xa end 'testa','testb';
41
--error ER_XAER_RMFAIL
43
--error ER_XAER_RMFAIL
44
create table t2 (a int);
46
connect (con1,localhost,root,,);
50
xa start 'testa','testb';
52
xa start 'testa','testb', 123;
54
# gtrid [ , bqual [ , formatID ] ]
55
xa start 0x7465737462, 0x2030405060, 0xb;
56
insert t1 values (40);
57
xa end 'testb',' 0@P`',11;
58
xa prepare 'testb',0x2030405060,11;
60
--error ER_XAER_RMFAIL
65
# uncomment the line below when binlog will be able to prepare
69
xa prepare 'testa','testb';
74
xa commit 'testb',0x2030405060,11;
75
xa rollback 'testa','testb';
77
--error ER_PARSE_ERROR
78
xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
87
# Bug#28323: Server crashed in xid cache operations
91
drop table if exists t1;
94
create table t1(a int, b int, c varchar(20), primary key(a)) engine = innodb;
95
insert into t1 values(1, 1, 'a');
96
insert into t1 values(2, 2, 'b');
98
connect (con1,localhost,root,,);
99
connect (con2,localhost,root,,);
103
update t1 set c = 'aa' where a = 1;
106
update t1 set c = 'bb' where a = 2;
108
--send update t1 set c = 'bb' where a = 2
111
--error ER_LOCK_DEADLOCK
112
update t1 set c = 'aa' where a = 1;
113
select count(*) from t1;
114
--error ER_XA_RBDEADLOCK
119
connect (con3,localhost,root,,);
129
--echo # BUG#51342 - more xid crashing
131
CREATE TABLE t1(a INT) ENGINE=InnoDB;
133
SET SESSION autocommit=0;
134
INSERT INTO t1 VALUES(1);
135
--error ER_XAER_RMFAIL
136
SET SESSION autocommit=1;
138
INSERT INTO t1 VALUES(1);
140
XA COMMIT 'x' ONE PHASE;
142
SET SESSION autocommit=1;
144
--echo End of 5.0 tests
147
# Bug#44672: Assertion failed: thd->transaction.xid_state.xid.is_null()
158
# Bug#45548: XA transaction without access to InnoDB tables crashes the server
172
# BUG#43171 - Assertion failed: thd->transaction.xid_state.xid.is_null()
174
CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
175
INSERT INTO t1 VALUES(1),(2);
176
connect(con1,localhost,root,,);
178
# Part 1: Prepare to test XA START after regular transaction deadlock
180
UPDATE t1 SET a=3 WHERE a=1;
184
UPDATE t1 SET a=4 WHERE a=2;
187
let $conn_id= `SELECT CONNECTION_ID()`;
188
SEND UPDATE t1 SET a=5 WHERE a=2;
191
let $wait_timeout= 2;
192
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
193
WHERE ID=$conn_id AND STATE='Searching rows for update';
194
--source include/wait_condition.inc
196
--error ER_LOCK_DEADLOCK
197
UPDATE t1 SET a=5 WHERE a=1;
200
# Part 2: Prepare to test XA START after XA transaction deadlock
205
UPDATE t1 SET a=3 WHERE a=1;
209
UPDATE t1 SET a=4 WHERE a=2;
212
SEND UPDATE t1 SET a=5 WHERE a=2;
215
let $wait_timeout= 2;
216
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
217
WHERE ID=$conn_id AND STATE='Searching rows for update';
218
--source include/wait_condition.inc
220
--error ER_LOCK_DEADLOCK
221
UPDATE t1 SET a=5 WHERE a=1;
222
--error ER_XA_RBDEADLOCK
235
--echo # Bug#56448 Assertion failed: ! is_set() with second xa end
240
# Second XA END caused an assertion.
241
--error ER_XAER_RMFAIL
244
# Second XA PREPARE also caused an assertion.
245
--error ER_XAER_RMFAIL
251
--echo # Bug#59986 Assert in Diagnostics_area::set_ok_status() for XA COMMIT
255
DROP TABLE IF EXISTS t1;
258
CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a)) engine=InnoDB;
259
INSERT INTO t1 VALUES (1, 1), (2, 2);
261
--echo # Connection con1
262
connect (con1, localhost, root);
264
UPDATE t1 SET b= 3 WHERE a=1;
266
--echo # Connection default
269
UPDATE t1 SET b=4 WHERE a=2;
271
--send UPDATE t1 SET b=5 WHERE a=1
273
--echo # Connection con1
276
--error ER_LOCK_DEADLOCK
277
UPDATE t1 SET b=6 WHERE a=2;
278
# This used to trigger the assert
279
--error ER_XA_RBDEADLOCK
282
--echo # Connection default
284
--echo # Reaping: UPDATE t1 SET b=5 WHERE a=1
293
--echo # Bug#11766752 59936: multiple xa assertions - transactional
294
--echo # statement fuzzer
297
CREATE TABLE t1 (a INT) engine=InnoDB;
299
INSERT INTO t1 VALUES (1);
304
--error ER_XAER_RMFAIL
306
--error ER_XAER_RMFAIL
307
INSERT INTO t1 VALUES (2);
308
--error ER_XAER_RMFAIL
310
--error ER_XAER_RMFAIL
311
SET @a=(SELECT * FROM t1);
314
--error ER_XAER_RMFAIL
315
SELECT * FROM t1; # used to cause InnoDB assert
316
--error ER_XAER_RMFAIL
317
INSERT INTO t1 VALUES (2); # used to cause InnoDB assert
318
--error ER_XAER_RMFAIL
320
--error ER_XAER_RMFAIL
321
SET @a=(SELECT * FROM t1); # used to cause InnoDB assert
322
--error ER_XAER_RMFAIL
323
UPDATE t1 SET a=1 WHERE a=2;
331
--echo # Bug#12352846 - TRANS_XA_START(THD*):
332
--echo # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL()
337
DROP TABLE IF EXISTS t1, t2;
340
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
341
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
344
INSERT INTO t1 VALUES (1);
346
--echo # Connection con2
347
--connect (con2,localhost,root)
350
--send INSERT INTO t2 SELECT a FROM t1
352
--echo # Connection default
355
SELECT COUNT(*) = 1 FROM information_schema.processlist
356
WHERE state = "Sending data"
357
AND info = "INSERT INTO t2 SELECT a FROM t1";
358
--echo # Waiting until INSERT ... is blocked
359
--source include/wait_condition.inc
363
--echo # Connection con2
365
--echo # Reaping: INSERT INTO t2 SELECT a FROM t1
366
--error ER_LOCK_DEADLOCK
368
--error ER_XA_RBDEADLOCK
371
--echo # Connection default
376
--echo # Connection con2
378
# This caused the assert to be triggered
385
--echo # Connection default
391
# Wait till all disconnects are completed
392
--source include/wait_until_count_sessions.inc