mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
28 lines
650 B
Text
28 lines
650 B
Text
connect con1,localhost,root,,;
|
|
connect con2,localhost,root,,;
|
|
connect con3,localhost,root,,;
|
|
# Drop test table
|
|
drop table if exists t;
|
|
# Create test table
|
|
create table t(a INT PRIMARY KEY, b INT) engine=InnoDB;
|
|
# Insert two rows to test table
|
|
insert into t values(2,1);
|
|
insert into t values(1,2);
|
|
connection con1;
|
|
BEGIN;
|
|
SELECT b FROM t WHERE a=1 FOR UPDATE;
|
|
connection con2;
|
|
BEGIN;
|
|
SELECT b FROM t WHERE a=2 FOR UPDATE;
|
|
connection con1;
|
|
SELECT b FROM t WHERE a=2 FOR UPDATE;
|
|
connection con2;
|
|
SELECT b FROM t WHERE a=1 FOR UPDATE;
|
|
connection con1;
|
|
ROLLBACK;
|
|
connection con2;
|
|
ROLLBACK;
|
|
connection con3;
|
|
Deadlocks: 1
|
|
# Drop test table
|
|
drop table t;
|