1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
connection node_2;
connection node_1;
create table t1 (f1 integer primary key) engine=innodb;
set autocommit=off;
set session wsrep_trx_fragment_size=1;
start transaction;
insert into t1 values (1);
insert into t1 values (2),(1);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
alter table t1 drop primary key;
drop table t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SET SESSION wsrep_trx_fragment_size=1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
update t1 set f1 = 100 where f1 = 10;
connection node_2;
INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
SET SESSION wsrep_trx_fragment_size=1;
SET SESSION innodb_lock_wait_timeout=1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
delete from t1 where f1 > 10;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
delete from t1 where f1 > 10 and f1 < 100;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
|