summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-01-28 14:15:01 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-01-28 14:15:01 +0200
commit6d1f1b61b59310027698a92ccf533a3093f1ce04 (patch)
treed2fbe999dc4df7ebbf2e4c6b20e3f902a0ddffb4 /sql/sql_table.cc
parent744e9752d887c3be20c655d882f6ec1b7e0fd727 (diff)
downloadmariadb-git-bb-10.5-MDEV-24564.tar.gz
MDEV-24564 Statistics are lost after ALTER TABLEbb-10.5-MDEV-24564
Ever since commit 007f68c37f6b77588866a04d7515aca084ab950d, ALTER TABLE no longer invokes handler::open() after handler::commit_inplace_alter_table(). ha_innobase::reload_statistics(): Reload or recompute statistics after ALTER TABLE. innodb_notify_tabledef_changed(): A new function to invoke ha_innobase::reload_statistics(). handlerton::notify_tabledef_changed(): Add the parameter handler* so that ha_innobase::reload_statistics() can be invoked. ha_partition::notify_tabledef_changed(), partition_notify_tabledef_changed(): Pass through the call to any partitions or subpartitions. This is based on code that was supplied by Monty.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 6825fbc8e24..116bfa7fd1c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
- Copyright (c) 2010, 2020, MariaDB
+ Copyright (c) 2010, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -7934,7 +7934,6 @@ static bool mysql_inplace_alter_table(THD *thd,
Alter_info *alter_info= ha_alter_info->alter_info;
bool reopen_tables= false;
bool res;
- handlerton *hton;
const enum_alter_inplace_result inplace_supported=
ha_alter_info->inplace_supported;
@@ -8145,20 +8144,22 @@ static bool mysql_inplace_alter_table(THD *thd,
/* Notify the engine that the table definition has changed */
- hton= table->file->partition_ht();
- if (hton->notify_tabledef_changed)
+ if (table->file->partition_ht()->notify_tabledef_changed)
{
char db_buff[FN_REFLEN], table_buff[FN_REFLEN];
+ handlerton *hton= table->file->ht;
LEX_CSTRING tmp_db, tmp_table;
- tmp_db.str= db_buff;
- tmp_table.str= table_buff;
+
+ tmp_db.str= db_buff;
+ tmp_table.str= table_buff;
tmp_db.length= tablename_to_filename(table_list->db.str,
db_buff, sizeof(db_buff));
tmp_table.length= tablename_to_filename(table_list->table_name.str,
table_buff, sizeof(table_buff));
if ((hton->notify_tabledef_changed)(hton, &tmp_db, &tmp_table,
table->s->frm_image,
- &table->s->tabledef_version))
+ &table->s->tabledef_version,
+ table->file))
{
my_error(HA_ERR_INCOMPATIBLE_DEFINITION, MYF(0));
DBUG_RETURN(true);