| 1 |
#Test for Intention Shared lock |
| 2 |
drop table if exists t1_is; |
| 3 |
use test; |
| 4 |
create table t1_is (id integer, x integer, PRIMARY KEY (id)) engine=INNODB; |
| 5 |
insert into t1_is values (0,0),(1,1); |
| 6 |
SET autocommit=0; |
| 7 |
begin; |
| 8 |
select * from t1_is where id=0 FOR SHARE; |
| 9 |
id x |
| 10 |
0 0 |
| 11 |
begin; |
| 12 |
select * from t1_is; |
| 13 |
id x |
| 14 |
0 0 |
| 15 |
1 1 |
| 16 |
update t1_is set x = 2 where id = 0; |
| 17 |
begin; |
| 18 |
select object_schema, object_name, lock_type, lock_mode, lock_status, lock_data |
| 19 |
from performance_schema.data_locks |
| 20 |
where object_name="t1_is" |
| 21 |
order by lock_type, lock_mode, lock_status, lock_data; |
| 22 |
object_schema object_name lock_type lock_mode lock_status lock_data |
| 23 |
test t1_is RECORD S,REC_NOT_GAP GRANTED 0 |
| 24 |
test t1_is RECORD X,REC_NOT_GAP WAITING 0 |
| 25 |
test t1_is TABLE IS GRANTED NULL |
| 26 |
test t1_is TABLE IX GRANTED NULL |
| 27 |
select object_schema, object_name, lock_type, lock_mode, lock_status, lock_data |
| 28 |
from performance_schema.data_locks |
| 29 |
where object_name="t1_is" |
| 30 |
order by lock_type, lock_mode, lock_status, lock_data; |
| 31 |
object_schema object_name lock_type lock_mode lock_status lock_data |
| 32 |
test t1_is RECORD S,REC_NOT_GAP GRANTED 0 |
| 33 |
test t1_is RECORD X,REC_NOT_GAP WAITING 0 |
| 34 |
test t1_is TABLE IS GRANTED NULL |
| 35 |
test t1_is TABLE IX GRANTED NULL |
| 36 |
select count(*) into @health_check |
| 37 |
from performance_schema.data_locks where object_name="t1_is"; |
| 38 |
commit; |
| 39 |
commit; |
| 40 |
commit; |
| 41 |
drop table t1_is; |