Commit 3b41c444 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-35020 After a failed attempt to create vector index temporary file...

MDEV-35020 After a failed attempt to create vector index temporary file remains and prevents further operation
parent 4db14f50
......@@ -117,3 +117,19 @@ t CREATE TABLE `t` (
VECTOR KEY `v` (`v`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ROW_FORMAT=COMPRESSED
drop table t;
#
# MDEV-35020 After a failed attempt to create vector index temporary file remains and prevents further operation
#
create table t (a int) engine=innodb;
insert into t values (1);
alter table t add v blob not null, add vector index (v);
ERROR 22007: Incorrect vector value: '...' for column `test`.`t`.`v` at row 1
alter table t add v blob not null default x'00000000', add vector index (v);
show create table t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL,
`v` blob NOT NULL DEFAULT X'00000000',
VECTOR KEY `v` (`v`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t;
source include/have_innodb.inc;
let $datadir= `select @@datadir`;
create table t1 (id int auto_increment primary key, v blob not null, vector index (v)) engine=innodb;
show create table t1;
# print unpack("H*",pack("f*",map{rand}1..8))
......@@ -96,3 +98,15 @@ alter table t add f int;
insert into t values (x'00000000',1);
show create table t;
drop table t;
--echo #
--echo # MDEV-35020 After a failed attempt to create vector index temporary file remains and prevents further operation
--echo #
create table t (a int) engine=innodb;
insert into t values (1);
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
alter table t add v blob not null, add vector index (v);
--list_files $datadir/test/ #*
alter table t add v blob not null default x'00000000', add vector index (v);
show create table t;
drop table t;
......@@ -1490,6 +1490,13 @@ bool THD::free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table)
if (delete_table)
{
error= rm_temporary_table(share->db_type(), share->path.str);
if (share->total_keys > share->keys)
{
/* as of now: only one vector index can be here */
DBUG_ASSERT(share->total_keys == share->keys + 1);
rm_temporary_table(share->hlindex->db_type(), share->hlindex->path.str);
}
}
free_table_share(share);
my_free(share);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment