Skip to content

Commit 0932c3a

Browse files
committed
MDEV-35044 ALTER on a table with vector index attempts to bypass unsupported locking limitation, server crashes in THD::free_tmp_table_share
open secondary tables early enough for the cleanup on error to see them and remove their underlying files
1 parent 824a638 commit 0932c3a

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# MDEV-35044 ALTER on a table with vector index attempts to bypass unsupported locking limitation, server crashes in THD::free_tmp_table_share
3+
#
4+
create table t (a int primary key, v blob not null, vector index(v));
5+
alter table t modify a int auto_increment, lock=none;
6+
ERROR 0A000: LOCK=NONE is not supported. Reason: CHANGE COLUMN ... AUTO_INCREMENT. Try LOCK=SHARED
7+
drop table t;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--source include/not_embedded.inc
2+
3+
--echo #
4+
--echo # MDEV-35044 ALTER on a table with vector index attempts to bypass unsupported locking limitation, server crashes in THD::free_tmp_table_share
5+
--echo #
6+
create table t (a int primary key, v blob not null, vector index(v));
7+
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
8+
alter table t modify a int auto_increment, lock=none;
9+
drop table t;

sql/sql_table.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11575,7 +11575,7 @@ do_continue:;
1157511575
new_table= thd->create_and_open_tmp_table(&frm, alter_ctx.get_tmp_path(),
1157611576
alter_ctx.new_db,
1157711577
alter_ctx.new_name, true);
11578-
if (!new_table)
11578+
if (!new_table || new_table->open_hlindexes_for_write())
1157911579
goto err_new_table_cleanup;
1158011580

1158111581
if (table->s->tmp_table != NO_TMP_TABLE)

0 commit comments

Comments
 (0)