summaryrefslogtreecommitdiff
path: root/sql/sql_reload.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2014-12-02 14:54:30 +0400
committerSergey Vojtovich <svoj@mariadb.org>2014-12-05 11:01:49 +0400
commitb4ec230917a50cbc1e406f5175189c8359bcb9a0 (patch)
tree1bc8664e0eccdab6c5e57a86ee76d02a200eb92c /sql/sql_reload.cc
parent9bc5cec0f115d7d0c277a49b91b96109560280f4 (diff)
downloadmariadb-git-b4ec230917a50cbc1e406f5175189c8359bcb9a0.tar.gz
MDEV-7004 - Merge scalability fixes from 10.0-power
Preallocate locks on THD mem_root to avoid expensive malloc.
Diffstat (limited to 'sql/sql_reload.cc')
-rw-r--r--sql/sql_reload.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index ca632f4a2fb..fe494c760dc 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -521,6 +521,8 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
}
}
+ thd->variables.option_bits|= OPTION_TABLE_LOCK;
+
/*
Before opening and locking tables the below call also waits
for old shares to go away, so the fact that we don't pass
@@ -534,7 +536,7 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
if (open_and_lock_tables(thd, all_tables, FALSE,
MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK,
&lock_tables_prelocking_strategy))
- goto error;
+ goto error_reset_bits;
if (thd->lex->type & REFRESH_FOR_EXPORT)
{
@@ -546,15 +548,14 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
{
my_error(ER_ILLEGAL_HA, MYF(0),table_list->table->file->table_type(),
table_list->db, table_list->table_name);
- return true;
+ goto error_reset_bits;
}
}
}
if (thd->locked_tables_list.init_locked_tables(thd))
- goto error;
+ goto error_reset_bits;
- thd->variables.option_bits|= OPTION_TABLE_LOCK;
/*
We don't downgrade MDL_SHARED_NO_WRITE here as the intended
@@ -565,6 +566,9 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
return FALSE;
+error_reset_bits:
+ close_thread_tables(thd);
+ thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
error:
return TRUE;
}