Commit f90ffae7 authored by Rich Prohaska's avatar Rich Prohaska

refs #5824 test cases for update and upsert deadlocks

git-svn-id: file:///svn/mysql/tests/mysql-test@51311 c7de825b-a66e-492c-adef-691d508d4ae1
parent edb34cfc
drop table if exists t;
create table t (id bigint primary key, b bigint not null default 0);
insert into t (id) values (1),(2);
set session tokudb_enable_fast_update=1;
begin;
update t set b=b+1 where id=1;
set session tokudb_enable_fast_update=1;
begin;
update t set b=b-1 where id=2;
update t set b=b+1 where id=2;
update t set b=b-1 where id=1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback;
commit;
select * from t;
id b
1 1
2 1
drop table t;
drop table if exists t;
create table t (id bigint primary key, b bigint not null default 0);
set session tokudb_enable_fast_upsert=1;
begin;
insert into t (id) values (1) on duplicate key update b=b+1;
set session tokudb_enable_fast_upsert=1;
begin;
insert into t (id) values (2) on duplicate key update b=b-1;
insert into t (id) values (2) on duplicate key update b=b+1;
insert into t (id) values (1) on duplicate key update b=b-1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
rollback;
commit;
select * from t;
id b
1 0
2 0
drop table t;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists t;
enable_warnings;
create table t (id bigint primary key, b bigint not null default 0);
insert into t (id) values (1),(2);
connect (conn1,localhost,root,,);
connection default;
set session tokudb_enable_fast_update=1;
begin;
update t set b=b+1 where id=1;
connection conn1;
set session tokudb_enable_fast_update=1;
begin;
update t set b=b-1 where id=2;
connection default;
send update t set b=b+1 where id=2;
connection conn1;
error 1213;
update t set b=b-1 where id=1;
rollback;
connection default;
reap;
commit;
connection default;
disconnect conn1;
select * from t;
drop table t;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists t;
enable_warnings;
create table t (id bigint primary key, b bigint not null default 0);
connect (conn1,localhost,root,,);
connection default;
set session tokudb_enable_fast_upsert=1;
begin;
insert into t (id) values (1) on duplicate key update b=b+1;
connection conn1;
set session tokudb_enable_fast_upsert=1;
begin;
insert into t (id) values (2) on duplicate key update b=b-1;
connection default;
send insert into t (id) values (2) on duplicate key update b=b+1;
connection conn1;
error 1213;
insert into t (id) values (1) on duplicate key update b=b-1;
rollback;
connection default;
reap;
commit;
connection default;
disconnect conn1;
select * from 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