[MDEV-25902] Unexpected ER_LOCK_WAIT_TIMEOUT and result after timeout, assertion failure err != DB_DUPLICATE_KEY Created: 2021-06-12 Updated: 2023-11-06 Resolved: 2021-07-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Locking, Partitioning, Storage Engine - InnoDB |
| Affects Version/s: | 10.6 |
| Fix Version/s: | 10.6.3 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Elena Stepanova | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | regression | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
In the test case above, the problem starts at
It looks new, 10.5 doesn't time out here. Further, even though the query fails, the partitioning is still performed:
And then, further partitioning on a different table returns an unexpected error (on non-debug) or a debug assertion failure:
Please note that the assertion failure is just an aftermath, the problems start long before it.
|
| Comments |
| Comment by Marko Mäkelä [ 2021-06-12 ] | ||||||||||||||||||||
|
This is probably due to | ||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-06-14 ] | ||||||||||||||||||||
|
The timeout is reported while ALTER TABLE t1 PARTITION BY HASH(pk) is dropping the original table (which carries a #sql-backup- name). The subsequent ALTER TABLE t2 would attempt to use the same #sql-backup- name, even though the previous ALTER TABLE t1 failed to drop that table. The timeout occurs due to a lock conflict on table t1. The conflicting lock had been created by the transaction in con1. The ROLLBACK TO SAVEPOINT will not release the lock on table t1 inside InnoDB. InnoDB was not even asked about that: there was no call to innobase_rollback_to_savepoint_can_release_mdl() before ALTER TABLE t1 PARTITION BY HASH(pk) was executed. This is a metadata locking (MDL) bug that likely was worked around by the background DROP TABLE queue that
| ||||||||||||||||||||
| Comment by Elena Stepanova [ 2021-06-28 ] | ||||||||||||||||||||
|
Raising to a blocker not as much due to the assertion failure but because of ALTER being performed even though it returns an error. | ||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-06-30 ] | ||||||||||||||||||||
|
Would you agree with my proposed fix? With that, we would never release any MDL after ROLLBACK TO SAVEPOINT if the transaction had acquired any locks in InnoDB. Only in that way can the MDL perform its intended task of detecting conflicts between DML and DDL. I think that a follow-up performance improvement could be filed, to enhance the handlerton::savepoint_rollback_can_release_mdl interface, so that the storage engines can indicate which MDL are OK to release. | ||||||||||||||||||||
| Comment by Sergei Golubchik [ 2021-07-01 ] | ||||||||||||||||||||
|
commit 161e4bfafd2 is ok to push |