Mysql innodb insert intention lock, mysqlinnodb
Innodb has an insert intention lock, specifically for Insert. If the gap is already locked by the gap before insertion, insert will apply for the Insert intention lock. So what is the role of this inserted intention lock?
1. In order to arouse the waiting. Because the gap already has a lock, it must be blocked during insertion. The intention lock is inserted with blocking function.
2. inserting the intention lock is a special gap lock. Since it is a gap lock, why not directly use the gap lock?
The gap locks are not mutually exclusive. If they are not blocked, they call up the wait, which may cause phantom read.
3. Why not use the record lock or next-key lock?
If the record or next-key lock is applied, the next-key lock may be mutually exclusive, which affects the insert concurrency.
I don't know if this understanding is correct. Have you studied inserting intention locks? Can you give me a suggestion?