diff options
author | Monty <monty@mariadb.org> | 2021-03-02 14:08:38 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2021-03-02 15:23:56 +0200 |
commit | 676987c4a14069d415c56d0f259aaaa7ca742c23 (patch) | |
tree | 87770cf27c7447b37f04c4a06923934bebf4df98 /sql/sql_cte.cc | |
parent | fc77431624b8d4dc966cd3855c16bee856b05645 (diff) | |
download | mariadb-git-676987c4a14069d415c56d0f259aaaa7ca742c23.tar.gz |
MDEV-24532 Table corruption ER_NO_SUCH_TABLE_IN_ENGINE .. on table with foreign key
When doing a truncate on an Innodb under lock tables, InnoDB would rename
the old table to #sql-... and recreate a new 't1' table. The table lock
would still be on the #sql-table.
When doing ALTER TABLE, Innodb would do the changes on the #sql table
(which would disappear on close).
When the SQL layer, as part of inline alter table, would close the
original t1 table (#sql in InnoDB) and then reopen the t1 table, Innodb
would notice that this does not match it's own (old) t1 table and
generate an error.
Fixed by adding code in truncate table that if we are under lock tables
and truncating an InnoDB table, we would close, reopen and lock the
table after truncate. This will remove the #sql table and ensure that
lock tables is using the new empty table.
Reviewer: Marko Mäkelä
Diffstat (limited to 'sql/sql_cte.cc')
0 files changed, 0 insertions, 0 deletions