51 lines
1.8 KiB
Plaintext
51 lines
1.8 KiB
Plaintext
#Test for Exclusive, GAP locks
|
|
drop table if exists t1_x_gap;
|
|
use test;
|
|
create table t1_x_gap (id int(10) primary key, x int(10)) engine=INNODB;
|
|
Warnings:
|
|
Warning 1681 Integer display width is deprecated and will be removed in a future release.
|
|
Warning 1681 Integer display width is deprecated and will be removed in a future release.
|
|
insert into t1_x_gap values (1,10),(2,20),(3,30),(4,40),(5,50);
|
|
start transaction;
|
|
select * from t1_x_gap where id<5 for update;
|
|
id x
|
|
1 10
|
|
2 20
|
|
3 30
|
|
4 40
|
|
select object_schema, object_name, lock_type, lock_mode, lock_status, lock_data
|
|
from performance_schema.data_locks
|
|
where object_name="t1_x_gap"
|
|
order by lock_type, lock_mode, lock_status, lock_data;
|
|
object_schema object_name lock_type lock_mode lock_status lock_data
|
|
test t1_x_gap RECORD X GRANTED 1
|
|
test t1_x_gap RECORD X GRANTED 2
|
|
test t1_x_gap RECORD X GRANTED 3
|
|
test t1_x_gap RECORD X GRANTED 4
|
|
test t1_x_gap RECORD X,GAP GRANTED 5
|
|
test t1_x_gap TABLE IX GRANTED NULL
|
|
start transaction;
|
|
insert into t1_x_gap values (0,0);
|
|
select object_schema, object_name, lock_type, lock_mode, lock_status
|
|
from performance_schema.data_locks
|
|
where object_name="t1_x_gap"
|
|
order by lock_type, lock_mode, lock_status;
|
|
object_schema object_name lock_type lock_mode lock_status
|
|
test t1_x_gap RECORD X GRANTED
|
|
test t1_x_gap RECORD X GRANTED
|
|
test t1_x_gap RECORD X GRANTED
|
|
test t1_x_gap RECORD X GRANTED
|
|
test t1_x_gap RECORD X,GAP GRANTED
|
|
test t1_x_gap RECORD X,GAP,INSERT_INTENTION WAITING
|
|
test t1_x_gap TABLE IX GRANTED
|
|
test t1_x_gap TABLE IX GRANTED
|
|
commit;
|
|
select object_schema, object_name, lock_type, lock_mode, lock_status
|
|
from performance_schema.data_locks
|
|
where object_name="t1_x_gap";
|
|
object_schema object_name lock_type lock_mode lock_status
|
|
test t1_x_gap TABLE IX GRANTED
|
|
test t1_x_gap RECORD X,GAP,INSERT_INTENTION GRANTED
|
|
commit;
|
|
drop table t1_x_gap;
|