1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Give warnings if open_stat_table_for_ddl() fails

The warning is given in case of table not found or if there is a lock
timeout. The warning is needed as in case of a lock timeout then the
persistent table stats are going to be wrong.
This commit is contained in:
Monty
2023-09-24 14:40:29 +03:00
parent 684f7f81a0
commit 4c8d2410b6
4 changed files with 21 additions and 4 deletions

View File

@@ -284,6 +284,10 @@ static int open_stat_tables(THD *thd, TABLE_LIST *tables, bool for_write)
@details
This is used by DDLs. When a column or index is dropped or renamed,
stat tables need to be adjusted accordingly.
This function should not generate any errors as the callers are not checking
the result of delete_statistics_for_table()
*/
static inline int open_stat_table_for_ddl(THD *thd, TABLE_LIST *table,
const LEX_CSTRING *stat_tab_name)
@@ -293,6 +297,14 @@ static inline int open_stat_table_for_ddl(THD *thd, TABLE_LIST *table,
thd->push_internal_handler(&nst_handler);
int res= open_system_tables_for_read(thd, table);
thd->pop_internal_handler();
if (res && nst_handler.any_error())
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CHECK_NO_SUCH_TABLE,
"Got error %d when trying to open statistics "
"table %`s for updating statistics",
nst_handler.got_error(), stat_table_name->str);
}
return res;
}