Bug #108488 | Gap locking issue in READ COMMITTED | ||
---|---|---|---|
Submitted: | 15 Sep 2022 7:50 | Modified: | 19 Sep 2022 13:59 |
Reporter: | Vinieth S S | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.7.18, 5.7.35, 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[15 Sep 2022 7:50]
Vinieth S S
[19 Sep 2022 12:45]
MySQL Verification Team
Hi Mr. S S, Thank you for your bug report. You are very correct in your analysis, but you did make a small mistake. Namely, in order for the locking to work as you described, your first transaction should have been committed. But, you did not do any commit, so the gap between supremum and your row still had to be locked !!!! Not a bug.
[19 Sep 2022 13:11]
Vinieth S S
Yes the case which you are mentioned is applicable only for Repeatable-Read, where as for READ COMMITTED isolation level - Gap lock is not necessary which is mentioned in doc. Mysql doc link - https://dev.mysql.com/doc/refman/5.7/en/innodb-locking.html#innodb-gap-locks:~:text=Gap%20.... And also this issue is reproducible only for delete and update. Not for insert in READ COMMITTED. Where as in Repeatable-Read it is applicable for all insert, update, delete.
[19 Sep 2022 13:15]
MySQL Verification Team
Hi Mr. S S, You are quite correct in what you write. However, in order for READ-COMMITTED to kick in, concurrent transaction has to be committed. That is elementary for MVCC storage engines, like InnoDB.
[19 Sep 2022 13:17]
Vinieth S S
Okay thanks. shall we update the doc that gap locking is done for delete and update even-though it is in READ-COMMITTED isolation level.
[19 Sep 2022 13:39]
MySQL Verification Team
Hi, Documentation will be appended, but not in the way that you imply. We must underline that gap locking remains for the writing transactions that are NOT committed.
[19 Sep 2022 13:59]
Vinieth S S
Thanks for the update