ギャップロック同士は競合しない
なんか言葉として正しくない気がするんだよな
? 内部的にギャップロックにはモードの概念はあるのだろうか
It is also worth noting here that conflicting locks can be held on a gap by different transactions. For example, transaction A can hold a shared gap lock (gap S-lock) on a gap while transaction B holds an exclusive gap lock (gap X-lock) on the same gap. The reason conflicting gap locks are allowed is that if a record is purged from an index, the gap locks held on the record by different transactions must be merged.
区別されてそう
と思ったけどperformance_schema.data_locksの表示はGAPとXが並列に表示されるんだよな
code:bash
mysql -uroot d -e "select * from performance_schema.data_locks\G"
*************************** 2. row ***************************
ENGINE: INNODB
ENGINE_LOCK_ID: 139652271000984:2:4:3:139652203883952
ENGINE_TRANSACTION_ID: 2074
THREAD_ID: 53
EVENT_ID: 16
OBJECT_SCHEMA: d
OBJECT_NAME: t
PARTITION_NAME: NULL
SUBPARTITION_NAME: NULL
INDEX_NAME: PRIMARY
OBJECT_INSTANCE_BEGIN: 139652203883952
LOCK_TYPE: RECORD
LOCK_MODE: X,GAP
LOCK_STATUS: GRANTED
LOCK_DATA: 5
うーん