Commit f457a113 authored by Sergei Petrunia's avatar Sergei Petrunia

Post-merge fixes: update .result for rocksdb.i_s_deadlock

parent ba03577a
...@@ -6,58 +6,74 @@ set global rocksdb_lock_wait_timeout = 10000; ...@@ -6,58 +6,74 @@ set global rocksdb_lock_wait_timeout = 10000;
# Clears deadlock buffer of any prior deadlocks. # Clears deadlock buffer of any prior deadlocks.
set global rocksdb_max_latest_deadlocks = 0; set global rocksdb_max_latest_deadlocks = 0;
set global rocksdb_max_latest_deadlocks = @prior_max_latest_deadlocks; set global rocksdb_max_latest_deadlocks = @prior_max_latest_deadlocks;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connect con3,localhost,root,,;
connection default;
show create table information_schema.rocksdb_deadlock; show create table information_schema.rocksdb_deadlock;
Table Create Table Table Create Table
ROCKSDB_DEADLOCK CREATE TEMPORARY TABLE `ROCKSDB_DEADLOCK` ( ROCKSDB_DEADLOCK CREATE TEMPORARY TABLE `ROCKSDB_DEADLOCK` (
`DEADLOCK_ID` bigint(8) NOT NULL DEFAULT '0', `DEADLOCK_ID` bigint(8) NOT NULL DEFAULT 0,
`TRANSACTION_ID` bigint(8) NOT NULL DEFAULT '0', `TRANSACTION_ID` bigint(8) NOT NULL DEFAULT 0,
`CF_NAME` varchar(193) NOT NULL DEFAULT '', `CF_NAME` varchar(193) NOT NULL DEFAULT '',
`WAITING_KEY` varchar(513) NOT NULL DEFAULT '', `WAITING_KEY` varchar(513) NOT NULL DEFAULT '',
`LOCK_TYPE` varchar(193) NOT NULL DEFAULT '', `LOCK_TYPE` varchar(193) NOT NULL DEFAULT '',
`INDEX_NAME` varchar(193) NOT NULL DEFAULT '', `INDEX_NAME` varchar(193) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(193) NOT NULL DEFAULT '', `TABLE_NAME` varchar(193) NOT NULL DEFAULT '',
`ROLLED_BACK` bigint(8) NOT NULL DEFAULT '0' `ROLLED_BACK` bigint(8) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
create table t (i int primary key) engine=rocksdb; create table t (i int primary key) engine=rocksdb;
insert into t values (1), (2), (3); insert into t values (1), (2), (3);
select * from information_schema.rocksdb_deadlock; select * from information_schema.rocksdb_deadlock;
DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK
Deadlock #1 Deadlock #1
connection con1;
begin; begin;
select * from t where i=1 for update; select * from t where i=1 for update;
i i
1 1
connection con2;
begin; begin;
select * from t where i=2 for update; select * from t where i=2 for update;
i i
2 2
connection con1;
select * from t where i=2 for update; select * from t where i=2 for update;
connection con2;
select * from t where i=1 for update; select * from t where i=1 for update;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback; rollback;
connection con1;
i i
2 2
rollback; rollback;
connection default;
select * from information_schema.rocksdb_deadlock; select * from information_schema.rocksdb_deadlock;
DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 1 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 1
Deadlock #2 Deadlock #2
connection con1;
begin; begin;
select * from t where i=1 for update; select * from t where i=1 for update;
i i
1 1
connection con2;
begin; begin;
select * from t where i=2 for update; select * from t where i=2 for update;
i i
2 2
connection con1;
select * from t where i=2 for update; select * from t where i=2 for update;
connection con2;
select * from t where i=1 for update; select * from t where i=1 for update;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback; rollback;
connection con1;
i i
2 2
rollback; rollback;
connection default;
select * from information_schema.rocksdb_deadlock; select * from information_schema.rocksdb_deadlock;
DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0
...@@ -66,21 +82,27 @@ DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0 ...@@ -66,21 +82,27 @@ DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 1 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 1
set global rocksdb_max_latest_deadlocks = 10; set global rocksdb_max_latest_deadlocks = 10;
Deadlock #3 Deadlock #3
connection con1;
begin; begin;
select * from t where i=1 for update; select * from t where i=1 for update;
i i
1 1
connection con2;
begin; begin;
select * from t where i=2 for update; select * from t where i=2 for update;
i i
2 2
connection con1;
select * from t where i=2 for update; select * from t where i=2 for update;
connection con2;
select * from t where i=1 for update; select * from t where i=1 for update;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback; rollback;
connection con1;
i i
2 2
rollback; rollback;
connection default;
select * from information_schema.rocksdb_deadlock; select * from information_schema.rocksdb_deadlock;
DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0
...@@ -94,52 +116,67 @@ select * from information_schema.rocksdb_deadlock; ...@@ -94,52 +116,67 @@ select * from information_schema.rocksdb_deadlock;
DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 1 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 1
connection con3;
set rocksdb_deadlock_detect_depth = 2; set rocksdb_deadlock_detect_depth = 2;
Deadlock #4 Deadlock #4
connection con1;
begin; begin;
select * from t where i=1 for update; select * from t where i=1 for update;
i i
1 1
connection con2;
begin; begin;
select * from t where i=2 for update; select * from t where i=2 for update;
i i
2 2
connection con3;
begin; begin;
select * from t where i=3 for update; select * from t where i=3 for update;
i i
3 3
connection con1;
select * from t where i=2 for update; select * from t where i=2 for update;
connection con2;
select * from t where i=3 for update; select * from t where i=3 for update;
connection con3;
select * from t where i=1 for update; select * from t where i=1 for update;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback; rollback;
connection con2;
i i
3 3
rollback; rollback;
connection con1;
i i
2 2
rollback; rollback;
connection default;
set global rocksdb_max_latest_deadlocks = 5; set global rocksdb_max_latest_deadlocks = 5;
select * from information_schema.rocksdb_deadlock; select * from information_schema.rocksdb_deadlock;
DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK
Deadlock #5 Deadlock #5
connection con1;
begin; begin;
select * from t where i=1 for update; select * from t where i=1 for update;
i i
1 1
connection con2;
begin; begin;
select * from t where i=2 for update; select * from t where i=2 for update;
i i
2 2
connection con3;
begin; begin;
select * from t where i=3 lock in share mode; select * from t where i=3 lock in share mode;
i i
3 3
connection con1;
select * from t where i=100 for update; select * from t where i=100 for update;
i i
select * from t where i=101 for update; select * from t where i=101 for update;
i i
select * from t where i=2 for update; select * from t where i=2 for update;
connection con2;
select * from t where i=3 lock in share mode; select * from t where i=3 lock in share mode;
i i
3 3
...@@ -150,14 +187,20 @@ i ...@@ -150,14 +187,20 @@ i
select * from t where i=1 lock in share mode; select * from t where i=1 lock in share mode;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback; rollback;
connection con1;
i i
2 2
rollback; rollback;
connection con3;
rollback; rollback;
connection default;
select * from information_schema.rocksdb_deadlock; select * from information_schema.rocksdb_deadlock;
DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK DEADLOCK_ID TRANSACTION_ID CF_NAME WAITING_KEY LOCK_TYPE INDEX_NAME TABLE_NAME ROLLED_BACK
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY EXCLUSIVE PRIMARY test.t 0
DEADLOCK_ID TRANSACTION_ID default WAITING_KEY SHARED PRIMARY test.t 1 DEADLOCK_ID TRANSACTION_ID default WAITING_KEY SHARED PRIMARY test.t 1
disconnect con1;
disconnect con2;
disconnect con3;
set global rocksdb_lock_wait_timeout = @prior_lock_wait_timeout; set global rocksdb_lock_wait_timeout = @prior_lock_wait_timeout;
set global rocksdb_deadlock_detect = @prior_deadlock_detect; set global rocksdb_deadlock_detect = @prior_deadlock_detect;
drop table t; drop table t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment