MDEV-25950 Ignoring strange row from mysql.innodb_index_stats after DDL

commit_try_rebuild(): Invoke trx_t::drop_table_statistics()
with the correct (original) name of the table.
This fixes a regression that was introduced in
commit 1bd681c8b3 (MDEV-25506 part 3).
This commit is contained in:
Marko Mäkelä 2021-06-22 17:52:54 +03:00
parent e1c953ef23
commit 9fc67c6bf3
3 changed files with 20 additions and 3 deletions

View file

@ -232,5 +232,17 @@ t1 ind3 n_diff_pfx01
t1 ind3 n_diff_pfx02
t1 ind3 n_leaf_pages
t1 ind3 size
ALTER TABLE t1 DROP b, FORCE;
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
table_name index_name stat_name
t1 GEN_CLUST_INDEX n_diff_pfx01
t1 GEN_CLUST_INDEX n_leaf_pages
t1 GEN_CLUST_INDEX size
t1 ind2 n_diff_pfx01
t1 ind2 n_diff_pfx02
t1 ind2 n_leaf_pages
t1 ind2 size
UPDATE t1 SET a = 1 WHERE c = 'foo';
DROP TABLE t1;
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
table_name index_name stat_name

View file

@ -225,5 +225,9 @@ ALTER TABLE t1 DROP INDEX ind2, ADD INDEX ind3(b),
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
ALTER TABLE t1 DROP b, FORCE;
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
UPDATE t1 SET a = 1 WHERE c = 'foo';
DROP TABLE t1;
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;

View file

@ -9961,10 +9961,11 @@ commit_try_rebuild(
error = row_rename_table_for_mysql(
rebuilt_table->name.m_name, old_name, trx, false);
if (error == DB_SUCCESS) {
error = trx->drop_table_statistics(
ctx->old_table->name);
/* The statistics for the surviving indexes will be
re-inserted in alter_stats_rebuild(). */
error = trx->drop_table_statistics(old_name);
if (error == DB_SUCCESS) {
error = trx->drop_table(*ctx->old_table);
error = trx->drop_table(*user_table);
}
}
}