Bug #107958 | Document for gap lock of InnoDB needs improvement | ||
---|---|---|---|
Submitted: | 25 Jul 2022 9:01 | Modified: | 26 Jul 2022 1:22 |
Reporter: | Jia Howard | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
Version: | 5.7 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | gap lock, innodb |
[25 Jul 2022 9:01]
Jia Howard
[25 Jul 2022 12:57]
MySQL Verification Team
Hi Mr. 宏超 贾, Thank you for your bug report. However, it is not a bug, but expected behaviour. The UPDATE on a non-existing row is behaving the same as if you would issue a locking SELECT statement on the same row. This is done in order to maintain consistent views for each session. Not a bug.
[25 Jul 2022 13:00]
MySQL Verification Team
Hi Mr . 宏超 贾, We agree with you that this should be documented. Hence, this is a verified documentation bug.
[26 Jul 2022 1:22]
Jia Howard
I also see SELECT ... LOCK IN SHARE MODE sets shared next-key locks on all index records the search encounters. However, only an index record lock is required for statements that lock rows using a unique index to search for a unique row. SELECT ... FOR UPDATE sets an exclusive next-key lock on every record the search encounters. However, only an index record lock is required for statements that lock rows using a unique index to search for a unique row. So, please update these together, since they make end users like us confused. Thanks.