Commit 9fc67c6b authored by Marko Mäkelä's avatar Marko Mäkelä

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 1bd681c8 (MDEV-25506 part 3).
parent e1c953ef
...@@ -232,5 +232,17 @@ t1 ind3 n_diff_pfx01 ...@@ -232,5 +232,17 @@ t1 ind3 n_diff_pfx01
t1 ind3 n_diff_pfx02 t1 ind3 n_diff_pfx02
t1 ind3 n_leaf_pages t1 ind3 n_leaf_pages
t1 ind3 size 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'; UPDATE t1 SET a = 1 WHERE c = 'foo';
DROP TABLE t1; DROP TABLE t1;
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
table_name index_name stat_name
...@@ -225,5 +225,9 @@ ALTER TABLE t1 DROP INDEX ind2, ADD INDEX ind3(b), ...@@ -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; 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'; UPDATE t1 SET a = 1 WHERE c = 'foo';
DROP TABLE t1; DROP TABLE t1;
SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
...@@ -9961,10 +9961,11 @@ commit_try_rebuild( ...@@ -9961,10 +9961,11 @@ commit_try_rebuild(
error = row_rename_table_for_mysql( error = row_rename_table_for_mysql(
rebuilt_table->name.m_name, old_name, trx, false); rebuilt_table->name.m_name, old_name, trx, false);
if (error == DB_SUCCESS) { if (error == DB_SUCCESS) {
error = trx->drop_table_statistics( /* The statistics for the surviving indexes will be
ctx->old_table->name); re-inserted in alter_stats_rebuild(). */
error = trx->drop_table_statistics(old_name);
if (error == DB_SUCCESS) { if (error == DB_SUCCESS) {
error = trx->drop_table(*ctx->old_table); error = trx->drop_table(*user_table);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment