summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test
blob: 455c510040721974fff229a3f8afa75329b4c0e3 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# verify that information_schema.tokudb_locks gets populated with locks for 2 clients

source include/have_tokudb.inc;
set default_storage_engine='tokudb';
set tokudb_prelock_empty=false;
disable_warnings;
drop table if exists t;
enable_warnings;

create table t (id int primary key);
set autocommit=0;
let $default_id=`select connection_id()`;

# should be empty
select * from information_schema.tokudb_locks;

connect (conn_a,localhost,root,,);
set autocommit=0;
set tokudb_prelock_empty=OFF; # disable bulk loader

insert into t values (1);

connect (conn_b,localhost,root,,);
set autocommit=0;
set tokudb_prelock_empty=OFF;
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes

send insert into t values (1);

# should find the presence of a lock on 2nd transaction
connection default;
let $wait_condition= select count(*)=1 from information_schema.processlist where info='insert into t values (1)' and state='update';
source include/wait_condition.inc;
real_sleep 1; # delay a little to shorten the update -> write row -> lock wait race

replace_column 1 TRX_ID 2 MYSQL_ID;
eval select * from information_schema.tokudb_locks; 

connection conn_a;
commit;
# verify that the lock on the 1st transaction is released and replaced by the lock for the 2nd transaction
let $wait_condition= select count(*)=1 from information_schema.tokudb_locks where locks_dname='./test/t-main';
source include/wait_condition.inc;

replace_column 1 TRX_ID 2 MYSQL_ID;
select * from information_schema.tokudb_locks;

connection conn_b;
--error 1062
reap;
commit;

disconnect conn_b;

connection default;
# verify that the lockwait on the 2nd transaction has been released
# should be be empty
select * from information_schema.tokudb_locks;

drop table t;