Bug #96013 | Lock mode when there is no primary key or index in the table | ||
---|---|---|---|
Submitted: | 27 Jun 2019 9:03 | Modified: | 27 Jun 2019 15:28 |
Reporter: | hongyu dong (OCA) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 8.0.16 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[27 Jun 2019 9:03]
hongyu dong
[27 Jun 2019 13:58]
MySQL Verification Team
Hi Mr. Dong, Thank you for your bug report. However, I do not think that this is a bug. First of all, you have no usable index, so all rows must be locked, since the table is scanned. Second, since 8.0.16, locks on the pseudo clustered index are also presented in that table. Third, since 8.0.13, locks are 100 % correctly presented, with the following explanation: - "X" if the lock is on both record and gap (a.k.a. "Next Key Lock" in our documentation) - "X,REC_NOT_GAP" if the lock is on record only (a.k.a. "Record Lock") - "X,GAP" if the lock is on the gap only (a.k.a. "GAP Lock") - "X,GAP,INSERT_INTENTION" if the lock is an insert intention lock There are still some complications when the lock is on supremum, in which case we usually don't add ",GAP" suffix, even though the lock behaves like a ",GAP" lock. As you can see there is no bug. Except for that Supremum behaviour, which is a known internal bug, which will be fixed in the near future.
[27 Jun 2019 15:28]
hongyu dong
Hi: Thank you for your answer, but as you said: - "X" if the lock is on both record and gap (a.k.a. "Next Key Lock" in our documentation) - "X,REC_NOT_GAP" if the lock is on record only (a.k.a. "Record Lock") Thank you for your answer, but as you said: Although there is no index available, GEN_CLUSTER_INDEX is an incremental value, which is inserted at the end of the table each time. I don't think the next-key lock is needed because the inserted value does not appear in the existing data. The lock_mode in the data_locks table should be "X, REC_NOT_GAP"
[27 Jun 2019 16:34]
MySQL Verification Team
Hi, When you do UPDATE on the existing index, then you get REC_NOT_GAP, but this is scanning operation. That is a completely different beat and described in our documentation.