[MDEV-13713] Unexpected deadlock upon concurrent insert into sequence Created: 2017-09-02 Updated: 2018-04-21 Resolved: 2018-04-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Sequences, Storage Engine - InnoDB |
| Affects Version/s: | 10.3 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Michael Widenius |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
I am not 100% sure it's a bug, but behavior is strange, so better to check if it's intended this way. In the test case below,
Both before and after ER_LOCK_DEADLOCK processlist says that the 2nd connection is waiting for table metadata lock. Two things seem strange to me.
|
| Comments |
| Comment by Elena Stepanova [ 2017-09-02 ] |
|
marko, if you have an opinion on the subject (e.g. whether the behavior is expected or not), please do share. |
| Comment by Marko Mäkelä [ 2017-09-04 ] |
|
As far as InnoDB is concerned, sequences are a special kind of a table, with the following properties:
So, the locking question should not involve InnoDB at all. Note that there were bugs that caused InnoDB to acquire locks earlier: |
| Comment by Michael Widenius [ 2018-04-21 ] |
|
I don't think this is a bug. The first statement can continue using the sequence with NEXT_VAL() until commit, but not do ALTER SEQUENCE or INSERT (which is the same thing). Trying to do an INSERT will cause a deadlock because of this. |
| Comment by Michael Widenius [ 2018-04-21 ] |
|
Not a bug |