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

MDEV-35267 Server crashes in _ma_reset_history upon altering on Aria table with vector key under lock

ALTER TABLE needs to open hlindex tables early enough, right after they
were created, so that cleanup after an error would see and delete them.

But they need to be external_lock-ed only in copy_data_between_tables,
after mysql_trans_prepare_alter_copy_data().

Let's move locking out of hlindex_open() into hlindex_lock()
This commit is contained in:
Sergei Golubchik
2024-10-29 09:44:24 +01:00
parent 5d9ebef41e
commit 784becf3e1
6 changed files with 42 additions and 7 deletions

View File

@@ -11555,9 +11555,14 @@ alter_copy:
new_table= thd->create_and_open_tmp_table(&frm, alter_ctx.get_tmp_path(),
alter_ctx.new_db,
alter_ctx.new_name, true);
if (!new_table || new_table->open_hlindexes_for_write())
if (!new_table)
goto err_new_table_cleanup;
DBUG_ASSERT(new_table->s->hlindexes() <= 1);
for (uint i= new_table->s->keys; i < new_table->s->total_keys; i++)
if (new_table->hlindex_open(i))
goto err_new_table_cleanup;
if (table->s->tmp_table != NO_TMP_TABLE)
{
/* in case of alter temp table send the tracker in OK packet */