summaryrefslogtreecommitdiff
path: root/sql/sql_insert.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
commitdd42aab8406e70caec4f58435c0281cddc8ea2c0 (patch)
tree9d2e97b85337c7ffc2bf1d2a6643b34baf1acda8 /sql/sql_insert.cc
parentb6e0f92f052a37568b984330b8cca8331c979a8d (diff)
downloadmariadb-git-dd42aab8406e70caec4f58435c0281cddc8ea2c0.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_insert.cc')
-rw-r--r--sql/sql_insert.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 45c9c0363dd..ddf7dcb22d0 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -545,7 +545,7 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
Open tables used for sub-selects or in stored functions, will also
cache these functions.
*/
- if (open_and_lock_tables(thd, table_list->next_global))
+ if (open_and_lock_tables(thd, table_list->next_global, TRUE, 0))
{
end_delayed_insert(thd);
DBUG_RETURN(TRUE);
@@ -569,7 +569,7 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
Use a normal insert.
*/
table_list->lock_type= TL_WRITE;
- DBUG_RETURN(open_and_lock_tables(thd, table_list));
+ DBUG_RETURN(open_and_lock_tables(thd, table_list, TRUE, 0));
}
@@ -646,7 +646,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
}
else
{
- if (open_and_lock_tables(thd, table_list))
+ if (open_and_lock_tables(thd, table_list, TRUE, 0))
DBUG_RETURN(TRUE);
}
lock_type= table_list->lock_type;
@@ -3619,7 +3619,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
{
- Open_table_context ot_ctx_unused(thd);
+ Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
/*
Here we open the destination table, on which we already have
an exclusive metadata lock.
@@ -3638,7 +3638,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
else
{
- Open_table_context ot_ctx_unused(thd);
+ Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
if (open_table(thd, create_table, thd->mem_root, &ot_ctx_unused,
MYSQL_OPEN_TEMPORARY_ONLY))
{