| 1 |
#Test for Exclusive, GAP locks |
| 2 |
drop table if exists t1_x_gap; |
| 3 |
use test; |
| 4 |
create table t1_x_gap (id int(10) primary key, x int(10)) engine=INNODB; |
| 5 |
Warnings: |
| 6 |
Warning 1681 Integer display width is deprecated and will be removed in a future release. |
| 7 |
Warning 1681 Integer display width is deprecated and will be removed in a future release. |
| 8 |
insert into t1_x_gap values (1,10),(2,20),(3,30),(4,40),(5,50); |
| 9 |
start transaction; |
| 10 |
select * from t1_x_gap where id<5 for update; |
| 11 |
id x |
| 12 |
1 10 |
| 13 |
2 20 |
| 14 |
3 30 |
| 15 |
4 40 |
| 16 |
select object_schema, object_name, lock_type, lock_mode, lock_status, lock_data |
| 17 |
from performance_schema.data_locks |
| 18 |
where object_name="t1_x_gap" |
| 19 |
order by lock_type, lock_mode, lock_status, lock_data; |
| 20 |
object_schema object_name lock_type lock_mode lock_status lock_data |
| 21 |
test t1_x_gap RECORD X GRANTED 1 |
| 22 |
test t1_x_gap RECORD X GRANTED 2 |
| 23 |
test t1_x_gap RECORD X GRANTED 3 |
| 24 |
test t1_x_gap RECORD X GRANTED 4 |
| 25 |
test t1_x_gap RECORD X,GAP GRANTED 5 |
| 26 |
test t1_x_gap TABLE IX GRANTED NULL |
| 27 |
start transaction; |
| 28 |
insert into t1_x_gap values (0,0); |
| 29 |
select object_schema, object_name, lock_type, lock_mode, lock_status |
| 30 |
from performance_schema.data_locks |
| 31 |
where object_name="t1_x_gap" |
| 32 |
order by lock_type, lock_mode, lock_status; |
| 33 |
object_schema object_name lock_type lock_mode lock_status |
| 34 |
test t1_x_gap RECORD X GRANTED |
| 35 |
test t1_x_gap RECORD X GRANTED |
| 36 |
test t1_x_gap RECORD X GRANTED |
| 37 |
test t1_x_gap RECORD X GRANTED |
| 38 |
test t1_x_gap RECORD X,GAP GRANTED |
| 39 |
test t1_x_gap RECORD X,GAP,INSERT_INTENTION WAITING |
| 40 |
test t1_x_gap TABLE IX GRANTED |
| 41 |
test t1_x_gap TABLE IX GRANTED |
| 42 |
commit; |
| 43 |
select object_schema, object_name, lock_type, lock_mode, lock_status |
| 44 |
from performance_schema.data_locks |
| 45 |
where object_name="t1_x_gap"; |
| 46 |
object_schema object_name lock_type lock_mode lock_status |
| 47 |
test t1_x_gap TABLE IX GRANTED |
| 48 |
test t1_x_gap RECORD X,GAP,INSERT_INTENTION GRANTED |
| 49 |
commit; |
| 50 |
drop table t1_x_gap; |