summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2010-02-24 18:04:00 +0100
committerJon Olav Hauglid <jon.hauglid@sun.com>2010-02-24 18:04:00 +0100
commite60ef89317cb6a3e1e21b2b05c2c9b44c2b0bb9e (patch)
tree9d2e97b85337c7ffc2bf1d2a6643b34baf1acda8 /sql/sql_acl.cc
parent1dd2f90faf79eb1b194c9af0cde987c8a7b3058f (diff)
downloadmariadb-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_acl.cc')
-rw-r--r--sql/sql_acl.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index fb257a6e5ec..86f62d9bf72 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -675,7 +675,7 @@ my_bool acl_reload(THD *thd)
tables[0].open_type= tables[1].open_type= tables[2].open_type= OT_BASE_ONLY;
init_mdl_requests(tables);
- if (simple_open_n_lock_tables(thd, tables))
+ if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{
/*
Execution might have been interrupted; only print the error message
@@ -1602,7 +1602,7 @@ bool change_password(THD *thd, const char *host, const char *user,
}
#endif
- if (!(table= open_ltable(thd, &tables, TL_WRITE, 0)))
+ if (!(table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(1);
mysql_mutex_lock(&acl_cache->lock);
@@ -3040,7 +3040,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
class LEX_COLUMN *column;
List_iterator <LEX_COLUMN> column_iter(columns);
- if (open_and_lock_tables(thd, table_list))
+ if (open_and_lock_tables(thd, table_list, TRUE, 0))
DBUG_RETURN(TRUE);
while ((column = column_iter++))
@@ -3146,7 +3146,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
*/
Query_tables_list backup;
thd->lex->reset_n_backup_query_tables_list(&backup);
- if (simple_open_n_lock_tables(thd,tables))
+ if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // Should never happen
close_thread_tables(thd); /* purecov: deadcode */
/* Restore the state of binlog format */
@@ -3374,7 +3374,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
}
#endif
- if (simple_open_n_lock_tables(thd,tables))
+ if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // Should never happen
close_thread_tables(thd);
/* Restore the state of binlog format */
@@ -3531,7 +3531,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
}
#endif
- if (simple_open_n_lock_tables(thd,tables))
+ if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // This should never happen
close_thread_tables(thd); /* purecov: deadcode */
/* Restore the state of binlog format */
@@ -3853,7 +3853,7 @@ static my_bool grant_reload_procs_priv(THD *thd)
TL_READ);
table.open_type= OT_BASE_ONLY;
- if (simple_open_n_lock_tables(thd, &table))
+ if (open_and_lock_tables(thd, &table, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{
close_thread_tables(thd);
DBUG_RETURN(TRUE);
@@ -3924,7 +3924,7 @@ my_bool grant_reload(THD *thd)
To avoid deadlocks we should obtain table locks before
obtaining LOCK_grant rwlock.
*/
- if (simple_open_n_lock_tables(thd, tables))
+ if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
goto end;
mysql_rwlock_wrlock(&LOCK_grant);
@@ -5227,7 +5227,7 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
}
#endif
- if (simple_open_n_lock_tables(thd, tables))
+ if (open_and_lock_tables(thd, tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
{ // This should never happen
close_thread_tables(thd);
DBUG_RETURN(-1);