Bug #97110 | Record's Partition Update Takes Gap Lock | ||
---|---|---|---|
Submitted: | 5 Oct 2019 12:00 | Modified: | 10 Oct 2019 11:01 |
Reporter: | Digvijay Singh | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 5.6.33 | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[5 Oct 2019 12:00]
Digvijay Singh
[7 Oct 2019 12:11]
MySQL Verification Team
Hi Mr. Singh, Thank you for your bug report. However, this is not a bug. When UPDATE moves a row from one partition to another, it effectively does an INSERT to the new partition, which has to take a gap lock. Not a bug.
[9 Oct 2019 10:24]
Digvijay Singh
Hi Sinisa Milivojevic, Thanks for the quick response. In the usual case of inserting a row in a partition/table the documentation states: "INSERT sets an exclusive lock on the inserted row. This lock is an index-record lock, not a next-key lock (that is, there is no gap lock) and does not prevent other sessions from inserting into the gap before the inserted row." And that is also the case in practice, where no gap locks are taken. Can you please throw some clarity on why the gap lock is needed in this case? If the gap lock is not needed to be taken then we can check behavior in latest versions/raise an enhancement request for the same. If it is needed then we can have the behavior documented for reference? Can the status of the ticket be open till the above clarifications are brought? Thanks, Digvijay
[9 Oct 2019 12:16]
MySQL Verification Team
Hi, Please, do read carefully our Reference Manual. Among other gap locks, there is one named insert-intention lock.
[10 Oct 2019 11:01]
Digvijay Singh
Right gap locks are taken but as mentioned in the documentation the gap locks don't block concurrent transactions from inserting within the same gap: "This lock signals the intent to insert in such a way that multiple transactions inserting into the same index gap need not wait for each other if they are not inserting at the same position within the gap"