Skip to content

Commit 9ddb94f

Browse files
committed
MDEV-35104 Invalid (old?) table or database name upon DDL on table with vector key and unique key
InnoDB rename needs the same workaround for hlindexes as it has for partitions
1 parent 7d9c0e4 commit 9ddb94f

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

mysql-test/main/vector_innodb.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,9 @@ connection default;
186186
xa recover;
187187
formatID gtrid_length bqual_length data
188188
DROP TABLE t;
189+
#
190+
# MDEV-35104 Invalid (old?) table or database name upon DDL on table with vector key and unique key
191+
#
192+
create table t (f varchar(1024) not null, v blob not null, unique(f)) engine=innodb charset=utf8mb3;
193+
alter table t add vector (v);
194+
drop table t;

mysql-test/main/vector_innodb.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,10 @@ connection default;
175175
#xa commit 'x';
176176
xa recover;
177177
DROP TABLE t;
178+
179+
--echo #
180+
--echo # MDEV-35104 Invalid (old?) table or database name upon DDL on table with vector key and unique key
181+
--echo #
182+
create table t (f varchar(1024) not null, v blob not null, unique(f)) engine=innodb charset=utf8mb3;
183+
alter table t add vector (v);
184+
drop table t;

storage/innobase/handler/ha_innodb.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,22 @@ is_partition(
275275

276276

277277

278+
/** Checks whether the file name belongs to a to the hlindex
279+
@param[in] file_name file name
280+
@return pointer to the end of the table name part of the file name, or NULL */
281+
static
282+
char*
283+
is_hlindex(
284+
/*=========*/
285+
char* file_name)
286+
{
287+
/* We look for pattern #i# to see if the table is hlindex
288+
MariaDB table. */
289+
return strstr(file_name, "#i#");
290+
}
291+
292+
293+
278294
/** Return the InnoDB ROW_FORMAT enum value
279295
@param[in] row_format row_format from "innodb_default_row_format"
280296
@return InnoDB ROW_FORMAT value from rec_format_t enum. */
@@ -20191,12 +20207,15 @@ innobase_rename_vc_templ(
2019120207

2019220208
/* For partition table, remove the partition name and use the
2019320209
"main" table name to build the template */
20194-
char* is_part = is_partition(tbname);
2019520210

20196-
if (is_part != NULL) {
20211+
if (char *is_part = is_partition(tbname)) {
2019720212
*is_part = '\0';
2019820213
tbnamelen = ulint(is_part - tbname);
2019920214
}
20215+
else if (char *is_hli = is_hlindex(tbname)) {
20216+
*is_hli = '\0';
20217+
tbnamelen = ulint(is_hli - tbname);
20218+
}
2020020219

2020120220
dbnamelen = filename_to_tablename(dbname, t_dbname,
2020220221
MAX_DATABASE_NAME_LEN + 1);

0 commit comments

Comments
 (0)