1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-29013 ER_KEY_NOT_FOUND/lock timeout upon online alter with long unique

1. ER_KEY_NOT_FOUND
general replcation problem, already fixed earlier.
test added.

2. ER_LOCK_WAIT_TIMEOUT
This is a long unique specific problem.

Sometimes, lookup_handler is created for to->file. To properly free it,
ha_reset should be called. It is usually done by calling
close_thread_table, but ALTER TABLE makes it differently. Hence, a single
ha_reset call is added to mysql_alter_table.

Also, event_mem_root is removed. Normally, no per-event data should be
allocated on thd->mem_root, that would mean a leak. And otherwise,
lookup_handler is lazily allocated, but its lifetime matches statement,
not event.
This commit is contained in:
Nikita Malyavin
2022-06-29 23:32:19 +03:00
committed by Sergei Golubchik
parent d6e0d29f84
commit 6e0f456090
4 changed files with 89 additions and 12 deletions

View File

@@ -627,8 +627,7 @@ bool THD::drop_temporary_table(TABLE *table, bool *is_trans, bool delete_table)
table->s->db.str, table->s->table_name.str));
// close all handlers in case it is statement abort and some can be left
if (is_error())
table->file->ha_reset();
table->file->ha_reset();
locked= lock_temporary_tables();