Bug #100554 | behavior of gap lock differs with data_locks tab after delete and insert record | ||
---|---|---|---|
Submitted: | 18 Aug 2020 6:16 | Modified: | 19 Aug 2020 15:49 |
Reporter: | Brian Yue (OCA) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | MySQL8.0.18 | OS: | Any (rhel-7.4) |
Assigned to: | CPU Architecture: | Any (intel x86) |
[18 Aug 2020 6:16]
Brian Yue
[18 Aug 2020 12:57]
MySQL Verification Team
Hi Mr. Yue, Thank you for your bug report. However, this is not a bug. It is better seen from the InnoDB lock status, but Performance_Schema shows sufficient info. Both records, where your column `num` is 10 and 15 are locked. So, when an INSERT comes and tries to insert between these two records, it can't obtain a gap lock. As simple as that. Not a bug.
[19 Aug 2020 15:27]
Jakub Lopuszanski
Hello there, It is perhaps a not optimal "naming convention", but LOCK_MODE should be understood like this: "S" => shared lock on both the gap before the record and the record (a.k.a. "Next Key lock") "S,GAP" => shared lock on the gap before the record only (a.k.a. "Gap Lock") "S,REC_NOT_GAP" => shared lock on the record only (a.k.a. "Record Lock") So, this entry you see: | num | RECORD | S | GRANTED | 15, 15 | is actually equivalent to combination of S,GAP + S,REC_NOT_GAP. Does it help?
[19 Aug 2020 15:49]
Brian Yue
Hello, dear Mr.Lopuszanski and Verification Team, Thanks for your reply, I have understood the the meaning of LOCK_MODE now. It's helpful for me. Thanks a lot, again.