Skip to content
Permalink
Browse files
MDEV-30235 InnoDB crash on table-rebuilding DDL when the statistics t…
…ables are corrupted

commit_try_rebuild(): Only invoke trx_t::drop_table_statistics()
if both InnoDB statistics tables are accessible (and exclusively
locked by the current transaction). This avoids a crash due to
ut_a(sym_node->table != NULL) in pars_retrieve_table_def().

The crash was repeated on a partial copy of a MariaDB 10.3 data
directory that lacked the *.ibd files for the statistics tables.
  • Loading branch information
dr-m committed Dec 15, 2022
1 parent 4f68302 commit 0a67daa
Showing 1 changed file with 5 additions and 1 deletion.
@@ -10101,6 +10101,7 @@ commit_try_rebuild(
ha_innobase_inplace_ctx*ctx,
TABLE* altered_table,
const TABLE* old_table,
bool statistics_exist,
trx_t* trx,
const char* table_name)
{
@@ -10171,7 +10172,9 @@ commit_try_rebuild(
if (error == DB_SUCCESS) {
/* The statistics for the surviving indexes will be
re-inserted in alter_stats_rebuild(). */
error = trx->drop_table_statistics(old_name);
if (statistics_exist) {
error = trx->drop_table_statistics(old_name);
}
if (error == DB_SUCCESS) {
error = trx->drop_table(*user_table);
}
@@ -11316,6 +11319,7 @@ ha_innobase::commit_inplace_alter_table(

if (commit_try_rebuild(ha_alter_info, ctx,
altered_table, table,
table_stats && index_stats,
trx,
table_share->table_name.str)) {
goto fail;

0 comments on commit 0a67daa

Please sign in to comment.