Bug #114446 | A deadlock example cause by lock inherit | ||
---|---|---|---|
Submitted: | 21 Mar 14:30 | Modified: | 21 Mar 16:42 |
Reporter: | Zongzhi Chen (OCA) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 8.0.* | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | deadlock, innodb |
[21 Mar 14:30]
Zongzhi Chen
[21 Mar 14:58]
MySQL Verification Team
Hi Mr. Chen, Thank you for your bug report. However, deadlocks are not bugs. Detecting and acting on deadlocks are a proof that InnoDB storage engine is working perfectly, according the transaction processing standards. Also, we do not see how we can change lock type. Locks with gaps, locks with no gaps, insert intention locks, next-key locks and others are performed exactly as the standard prescribes them. Changing the manner of granting locks and inheritance of the locks, will definitely lead to the breaking of both MVCC and ACID standards. It would lead to a far greater number of bugs and some hard problems in the production. Once again, discovering deadlocks is a feature and not a bug.
[21 Mar 16:42]
Zongzhi Chen
Ok, get it. Discovering deadlocks is a feature and not a bug. I want discuss the topic is lock inherit may change the lock behavior. Such as in this case before the lock inherit the two X,REC_NOT_GAP locks is conflict, after lock inherit the two X,GAP locks is not conflict. The lock inherit should take into account this case, it should review the inherit strategy, should next record lock inherit from previous X,REC_NOT_GAP be X, NEXT_KEY or X, GAP?
[22 Mar 11:07]
MySQL Verification Team
Hi, We would just like to inform you that your idea would bring some improvements in some areas, but many other problems in other areas. Due to the vast complexity of the transaction code , there would be a number of regression bugs. However, we would like to inform you that we have some ideas of our own, which will reduce some semaphore waits and deadlocks. However, those will be implemented in the future and in a very slow and careful manner. We already changed the standard, by removing lock waits and deadlocks due to the escalation of the locks. Hence, this is a slow, but ongoing process. Your idea will not be forgotten and may form a part of some new WorkLog entry.
[22 Apr 5:09]
bumhwak lee
No matter how much I try, a deadlock does not occur. Is it correct that I can physically delete a record while a transaction is open?
[22 Apr 10:14]
MySQL Verification Team
Hi, Yes, you can delete a row within a transaction, or in another concurrent transaction. The results will depend on the isolation level that you are using, as explained here: https://dev.mysql.com/doc/refman/8.0/en/innodb-consistent-read.html