1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Honor lock_wait_timeout when updating stats tables

- Call delete_statistics_tables() after lock_table_names in drop tables.
  This avoids a deadlock issue with FTWRL and future backup locks.
- Added some missing clear_error()
- Ensure we don't clear error caused by the caller
- Updated function comments
This commit is contained in:
Monty
2018-11-27 16:59:29 +02:00
parent e54643a063
commit f386b70beb
3 changed files with 51 additions and 34 deletions

View File

@ -2040,18 +2040,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
if (!drop_temporary)
{
if (!in_bootstrap)
{
for (table= tables; table; table= table->next_local)
{
LEX_CSTRING db_name= table->db;
LEX_CSTRING table_name= table->table_name;
if (table->open_type == OT_BASE_ONLY ||
!thd->find_temporary_table(table))
(void) delete_statistics_for_table(thd, &db_name, &table_name);
}
}
if (!thd->locked_tables_mode)
{
if (drop_sequence)
@ -2115,6 +2103,18 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
}
}
}
/* We remove statistics for table last, after we have the DDL lock */
if (!in_bootstrap)
{
for (table= tables; table; table= table->next_local)
{
LEX_CSTRING db_name= table->db;
LEX_CSTRING table_name= table->table_name;
if (table->open_type == OT_BASE_ONLY ||
!thd->find_temporary_table(table))
(void) delete_statistics_for_table(thd, &db_name, &table_name);
}
}
}
/* mark for close and remove all cached entries */
@ -2127,7 +2127,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
DBUG_RETURN(TRUE);
my_ok(thd);
DBUG_RETURN(FALSE);
}