diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-02-24 18:04:00 +0100 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-02-24 18:04:00 +0100 |
commit | e60ef89317cb6a3e1e21b2b05c2c9b44c2b0bb9e (patch) | |
tree | 9d2e97b85337c7ffc2bf1d2a6643b34baf1acda8 /sql/sql_udf.cc | |
parent | 1dd2f90faf79eb1b194c9af0cde987c8a7b3058f (diff) | |
download | mariadb-git-e60ef89317cb6a3e1e21b2b05c2c9b44c2b0bb9e.tar.gz |
Followup to Bug#45225 Locking: hang if drop table with no timeout
This patch prevents system threads and system table accesses from
using user-specified values for "lock_wait_timeout". Instead all
such accesses are done using the default value (1 year).
This prevents background tasks (such as replication, events,
accessing stored function definitions, logging, reading time-zone
information, etc.) from failing in cases where the global value
of "lock_wait_timeout" is set very low.
The patch also simplifies the open tables API. Rather than adding
another convenience function for opening and locking system tables,
this patch removes most of the existing convenience functions for
open_and_lock_tables_derived(). Before, open_and_lock_tables() was
a convenience function that enforced derived tables handling, while
open_and_lock_tables_derived() was the main function where derived
tables handling was optional. Now, this convencience function is
gone and the main function is renamed to open_and_lock_tables().
No test case added as it would have required the use of --sleep to
check that system threads and system tables have a different timeout
value from the user-specified "lock_wait_timeout" system variable.
Diffstat (limited to 'sql/sql_udf.cc')
-rw-r--r-- | sql/sql_udf.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 3bead5217f0..7dfcf9f6b2e 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -163,7 +163,7 @@ void udf_init() tables.init_one_table(db, sizeof(db)-1, "func", 4, "func", TL_READ); - if (simple_open_n_lock_tables(new_thd, &tables)) + if (open_and_lock_tables(new_thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT)) { DBUG_PRINT("error",("Can't open udf table")); sql_print_error("Can't open the mysql.func table. Please " @@ -505,7 +505,7 @@ int mysql_create_function(THD *thd,udf_func *udf) tables.init_one_table("mysql", 5, "func", 4, "func", TL_WRITE); /* Allow creation of functions even if we can't open func table */ - if (!(table = open_ltable(thd, &tables, TL_WRITE, 0))) + if (!(table = open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT))) goto err; table->use_all_columns(); restore_record(table, s->default_values); // Default values for fields @@ -596,7 +596,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) tables.init_one_table("mysql", 5, "func", 4, "func", TL_WRITE); - if (!(table = open_ltable(thd, &tables, TL_WRITE, 0))) + if (!(table = open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT))) goto err; table->use_all_columns(); table->field[0]->store(exact_name_str, exact_name_len, &my_charset_bin); |