Skip to content

Commit 9a81540

Browse files
committed
MDEV-17043 Purge of indexed virtual columns may cause hang on table-rebuilding DDL
When a table is renamed to an internal #sql2 or #sql-ib name during a table-rebuilding DDL operation such as OPTIMIZE TABLE or ALTER TABLE, and shortly after that a purge operation in an index on virtual columns is attempted, the operation could fail, but purge would fail to release the table reference. innodb_acquire_mdl(): Release the reference if the table name is not valid for acquiring a meta-data lock (MDL). innodb_find_table_for_vc(): Add a debug assertion if the table name is not valid. This code path is for DML execution. The table should have a valid name for executing DML, and furthermore a MDL will prevent the table from being renamed. row_vers_build_clust_v_col(): Add a debug assertion that both indexes must belong to the same table.
1 parent 5d650d3 commit 9a81540

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21425,6 +21425,7 @@ static TABLE* innodb_acquire_mdl(THD* thd, dict_table_t* table)
2142521425

2142621426
if (!table_name_parse(table->name, db_buf, tbl_buf,
2142721427
db_buf_len, tbl_buf_len)) {
21428+
table->release();
2142821429
return NULL;
2142921430
}
2143021431

@@ -21507,6 +21508,7 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table)
2150721508

2150821509
if (!table_name_parse(table->name, db_buf, tbl_buf,
2150921510
db_buf_len, tbl_buf_len)) {
21511+
ut_ad(!"invalid table name");
2151021512
return NULL;
2151121513
}
2151221514

storage/innobase/row/row0vers.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ row_vers_build_clust_v_col(
456456
byte* record= 0;
457457

458458
ut_ad(dict_index_has_virtual(index));
459+
ut_ad(index->table == clust_index->table);
459460

460461
if (vcol_info != NULL) {
461462
vcol_info->set_used();

0 commit comments

Comments
 (0)