| 1 |
# |
| 2 |
# Test of wrong call to unlock_row |
| 3 |
# MDEV-5629 Failing assertion: state == TRX_STATE_NOT_STARTED on |
| 4 |
# concurrent CREATE OR REPLACE and transactional UPDATE |
| 5 |
# |
| 6 |
|
| 7 |
--disable_query_log |
| 8 |
call mtr.add_suppression("InnoDB: Transaction was aborted due to "); |
| 9 |
--enable_query_log |
| 10 |
|
| 11 |
--source include/have_innodb.inc |
| 12 |
|
| 13 |
CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB; |
| 14 |
INSERT INTO t1 VALUES (1,1),(2,2); |
| 15 |
|
| 16 |
CREATE TABLE t2 (c INT, d INT) ENGINE=InnoDB; |
| 17 |
INSERT INTO t2 VALUES (1,1), (2,2); |
| 18 |
|
| 19 |
CREATE TABLE t3 (e INT) ENGINE=InnoDB; |
| 20 |
CREATE TABLE t4 ENGINE=InnoDB AS SELECT * FROM t2; |
| 21 |
|
| 22 |
--connect (con11,localhost,root,,test) |
| 23 |
|
| 24 |
BEGIN; |
| 25 |
UPDATE t1 SET a = 0 WHERE a = ( SELECT e FROM t3 ); |
| 26 |
|
| 27 |
--connect (con12,localhost,root,,test) |
| 28 |
|
| 29 |
--send |
| 30 |
UPDATE t4 SET d = 1 WHERE d in ( SELECT a FROM t1 ) ORDER BY c LIMIT 6; |
| 31 |
|
| 32 |
--connection con11 |
| 33 |
|
| 34 |
# Wait for con12 to start waiting for con11 |
| 35 |
let $wait_condition= |
| 36 |
select count(*) = 1 from information_schema.innodb_trx |
| 37 |
where trx_state = "lock wait" and |
| 38 |
trx_query like "%SELECT a FROM t1%"; |
| 39 |
--source include/wait_condition.inc |
| 40 |
|
| 41 |
UPDATE t4 SET d = 9; |
| 42 |
|
| 43 |
--connection con12 |
| 44 |
--error ER_LOCK_DEADLOCK |
| 45 |
--reap |
| 46 |
--connection con11 |
| 47 |
commit; |
| 48 |
--connection default |
| 49 |
--disconnect con12 |
| 50 |
--disconnect con11 |
| 51 |
drop table t1,t2,t3,t4; |
| 52 |
|
| 53 |
call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); |
| 54 |
call mtr.add_suppression("Sort aborted.*"); |