Skip to content

Commit

Permalink
Replace find_temporary_table() with is_temporary_table()
Browse files Browse the repository at this point in the history
DROP TABLE opens all temporary tables at start, but then
uses find_temporary_table() to check if a table is temporary
instead of is_temporary_table() which is much faster.

This patch fixes this issue.
  • Loading branch information
montywi authored and vuvova committed May 19, 2021
1 parent 949d10b commit f671a9d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4930,7 +4930,7 @@ mysql_execute_command(THD *thd)
{
if (!lex->tmp_table() &&
(!thd->is_current_stmt_binlog_format_row() ||
!thd->find_temporary_table(table)))
!is_temporary_table(table)))
{
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, all_tables);
break;
Expand Down
3 changes: 1 addition & 2 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2131,8 +2131,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, bool if_exists,
{
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))
if (!is_temporary_table(table))
(void) delete_statistics_for_table(thd, &db_name, &table_name);
}
}
Expand Down

0 comments on commit f671a9d

Please sign in to comment.