Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.5.0, 10.5
Description
Merging to 10.5 the following code change of MDEV-23632 causes the last step of the test gcol.innodb_virtual_stats to fail:
@@ -11189,44 +11237,19 @@ ha_innobase::commit_inplace_alter_table(
|
Currently dict_load_column_low() is the only place where
|
num_base for virtual columns is assigned to nonzero. */
|
if (ctx0->num_to_drop_vcol || ctx0->num_to_add_vcol
|
+ || (ctx0->new_table->n_v_cols && !new_clustered
|
+ && (ha_alter_info->alter_info->drop_list.elements
|
+ || ha_alter_info->alter_info->create_list.elements))
|
|| (ctx0->is_instant()
|
&& m_prebuilt->table->n_v_cols
|
&& ha_alter_info->handler_flags & ALTER_STORED_COLUMN_ORDER)) {
|
...
|
The table will lose all persistent statistics:
CURRENT_TEST: gcol.innodb_virtual_stats
|
--- /mariadb/10.5m/mysql-test/suite/gcol/r/innodb_virtual_stats.result 2020-11-18 08:34:35.136411687 +0200
|
+++ /mariadb/10.5m/mysql-test/suite/gcol/r/innodb_virtual_stats.reject 2021-01-11 12:57:24.756571844 +0200
|
@@ -121,19 +121,4 @@
|
FROM mysql.innodb_index_stats
|
WHERE database_name = 'test' AND table_name = 't';
|
index_name stat_name stat_description
|
-GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
|
-GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
|
-GEN_CLUST_INDEX size Number of pages in the index
|
-idxb n_diff_pfx01 b
|
-idxb n_diff_pfx02 b,DB_ROW_ID
|
-idxb n_leaf_pages Number of leaf pages in the index
|
-idxb size Number of pages in the index
|
-vidxe n_diff_pfx01 e
|
-vidxe n_diff_pfx02 e,DB_ROW_ID
|
-vidxe n_leaf_pages Number of leaf pages in the index
|
-vidxe size Number of pages in the index
|
-vidxf n_diff_pfx01 f
|
-vidxf n_diff_pfx02 f,DB_ROW_ID
|
-vidxf n_leaf_pages Number of leaf pages in the index
|
-vidxf size Number of pages in the index
|
DROP TABLE t;
|
|
mysqltest: Result length mismatch
|
In both 10.4 and 10.5, we counter-intuitively have ha_alter_info->alter_info->create_list.elements == 5 for the preceding statement:
ALTER TABLE t DROP INDEX vidxcd; |
The reason why this fails in 10.5 appears to be a change to "Remove not needed open/close call at end of inline alter table." The ha_innobase::open() call is needed for initializing the persistent statistics after a native ALTER TABLE:
if (ib_table->is_readable()) { |
dict_stats_init(ib_table);
|
} else { |
ib_table->stat_initialized = 1;
|
}
|
I agree that this is not ideal, but that work-around was added in MySQL 5.7 and is not easy to remove without a major rewrite (MDEV-22363).
Attachments
Issue Links
- causes
-
MDEV-24754 Server crash in dict_v_col_t::~dict_v_col_t / ha_partition_inplace_ctx::~ha_partition_inplace_ctx
-
- Closed
-
- relates to
-
MDEV-23632 ALTER TABLE...ADD KEY creates corrupted index on virtual column
-
- Closed
-
Why can't innodb do the above init of persistent statistics in handler::notify_tabledef_has_changed()?
We cannot do things as they where before as that would interfere with discoverable tables.
In other words, we have to inform the engine that the table has changed BEFORE the table is closed and used again. The old code opened the new table and after it open informed the engine that the definition has been changed (which is too late)
I do not understand the comment about ha_alter_info->alter_info->create_list.elements == 5
After mysql_prepare_alter_table() call as part of the above ALTER TABLE we have:
{dummy_for_valgrind = false}p alter_info->create_list
$9 = {<base_list> = {<Sql_alloc> =
, first = 0x7fffc01de730, last = 0x7fffc021ccd8, elements = 4}, Which gives us 4 elements that matches fields a,b,d,e in the table