[MDEV-25500] Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed in uint handler::get_dup_key(int) Created: 2021-04-23 Updated: 2022-11-08 Resolved: 2022-11-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5, 10.6 |
| Fix Version/s: | 10.6.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Ramesh Sivaraman | Assignee: | Marko Mäkelä |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Leads to:
Bug confirmed present in: Bug (or feature/syntax) confirmed not present in: |
| Comments |
| Comment by Sergei Golubchik [ 2021-04-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ramesh, is it a bug? may be it's supposed to crash. Please, clarify. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ramesh Sivaraman [ 2021-04-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
serg I think it is a bug as the crash is only happening when we execute DROP TABLE immediately after ALTER TABLE statement. When we add 1 sec delay after ALTER TABLE statement the crash is not happening. innodb.drop_table_background MTR test also crashing if we add ALTER TABLE statement in the testcase.
Executed DROP TABLE statement after ALTER TABLE statement without any delay.
Executed DROP TABLE statement after ALTER TABLE statement with 1sec delay.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-04-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The issue is also only present in 10.2 so something changed in 10.3 and onwards. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2021-04-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What does this row_drop_table_add_to_background do? Could a crash be an expected effect of it? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-04-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I can repeat the crash on 10.6 with a more generic test case that does not depend on
The duplicate table name was created in ctx->tmp_name by dict_mem_create_temporary_tablename() in ha_innobase::commit_inplace_alter_table() for discarding the old copy of t1. We used the wrong table identifier when constructing the name. The purpose of that identifier is to ultimately discard the old copy of the table. The following patch makes the test case pass:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-04-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
My code change would cause a failure of an existing regression test:
The server error log contains the following:
The background DROP TABLE queue would be removed in A more complex scenario would involve a FOREIGN KEY check that is being performed on the table near the time the ALTER TABLE is finishing. In that case, the old copy of the table would be renamed, to be added to the background DROP TABLE queue. If a DROP TABLE is being executed on the newly rebuilt table such that also for that table, another FOREIGN KEY check is in progress, and the queue had not been emptied yet, then we would have a duplicate name for the table. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-05-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For the originally reported failure, a possible solution could be to allocate a different type of a temporary table name in ha_innobase::commit_inplace_alter_table(). That name could consist of both the current table ID as well as the related table ID. In that way, a clash between the two to-be-dropped table names would not be possible. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-11-08 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This was fixed in |