summaryrefslogtreecommitdiff
path: root/sql/lock.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2009-12-02 18:22:15 +0300
committerKonstantin Osipov <kostja@sun.com>2009-12-02 18:22:15 +0300
commitbcae0d9bab24165bc58090187ba0a51babe0e8ac (patch)
treee25111d23124912ae062b22e9503051a57bb23c3 /sql/lock.cc
parentcf4a4ba6fdce6e37c0a97bcf9b6653456a5ff374 (diff)
downloadmariadb-git-bcae0d9bab24165bc58090187ba0a51babe0e8ac.tar.gz
Backport of:
---------------------------------------------------------- revno: 2630.10.1 committer: Konstantin Osipov <konstantin@mysql.com> branch nick: mysql-6.0-lock-tables-tidyup timestamp: Wed 2008-06-11 15:49:58 +0400 message: WL#3726, review fixes. Now that we have metadata locks, we don't need to keep a crippled TABLE instance in the table cache to indicate that a table is locked. Remove all code that used this technique. Instead, rely on metadata locks and use the standard open_table() and close_thread_table() to manipulate with the table cache tables. Removes a list of functions that have become unused (see the comment for sql_base.cc for details). Under LOCK TABLES, keep a TABLE_LIST instance for each table that may be temporarily closed. For that, implement an own class for LOCK TABLES mode, Locked_tables_list. This is a pre-requisite patch for WL#4144. This is not exactly a backport: there is no new online ALTER table in Celosia, so the old alter table code was changed to work with the new table cache API.
Diffstat (limited to 'sql/lock.cc')
-rw-r--r--sql/lock.cc22
1 files changed, 4 insertions, 18 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index 33c9edcea48..814eebde337 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -512,28 +512,15 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
/**
Try to find the table in the list of locked tables.
In case of success, unlock the table and remove it from this list.
-
- @note This function has a legacy side effect: the table is
- unlocked even if it is not found in the locked list.
- It's not clear if this side effect is intentional or still
- desirable. It might lead to unmatched calls to
- unlock_external(). Moreover, a discrepancy can be left
- unnoticed by the storage engine, because in
- unlock_external() we call handler::external_lock(F_UNLCK) only
- if table->current_lock is not F_UNLCK.
+ If a table has more than one lock instance, removes them all.
@param thd thread context
@param locked list of locked tables
@param table the table to unlock
- @param always_unlock specify explicitly if the legacy side
- effect is desired.
*/
-void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table,
- bool always_unlock)
+void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table)
{
- if (always_unlock == TRUE)
- mysql_unlock_some_tables(thd, &table, /* table count */ 1);
if (locked)
{
reg1 uint i;
@@ -547,9 +534,8 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table,
DBUG_ASSERT(table->lock_position == i);
- /* Unlock if not yet unlocked */
- if (always_unlock == FALSE)
- mysql_unlock_some_tables(thd, &table, /* table count */ 1);
+ /* Unlock the table. */
+ mysql_unlock_some_tables(thd, &table, /* table count */ 1);
/* Decrement table_count in advance, making below expressions easier */
old_tables= --locked->table_count;