summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-12-15 16:18:43 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-12-15 16:18:43 +0200
commit0a67daad060459c27a1fb776e0a654a76c457804 (patch)
treeeafaef2d1a54624b0b28768cdfc2ebbddde77ad1
parent4f6830255c1dfcba3ec18aaedf6233713a7756c1 (diff)
downloadmariadb-git-0a67daad060459c27a1fb776e0a654a76c457804.tar.gz
MDEV-30235 InnoDB crash on table-rebuilding DDL when the statistics tables 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.
-rw-r--r--storage/innobase/handler/handler0alter.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index f91c0a23c08..dd83ed49af0 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -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 @@ fail:
if (commit_try_rebuild(ha_alter_info, ctx,
altered_table, table,
+ table_stats && index_stats,
trx,
table_share->table_name.str)) {
goto fail;