summaryrefslogtreecommitdiff
path: root/sql/lock.cc
diff options
context:
space:
mode:
authorsvoj@april.(none) <>2007-07-25 19:58:18 +0500
committersvoj@april.(none) <>2007-07-25 19:58:18 +0500
commit5c83b14b48445f3759a885f86455ebf120f0e566 (patch)
tree3894b838cefa470476224e6abb155cc557665ce5 /sql/lock.cc
parente894244733a274598d812a6e6469e0d8a11e50b5 (diff)
parent3b18aae71c49f1e85e00b82184a992b70fa8b597 (diff)
downloadmariadb-git-5c83b14b48445f3759a885f86455ebf120f0e566.tar.gz
Merge mysql.com:/home/svoj/devel/bk/mysql-5.1-engines
into mysql.com:/home/svoj/devel/mysql/BUG29806/mysql-5.1-engines
Diffstat (limited to 'sql/lock.cc')
-rw-r--r--sql/lock.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index 4260a031def..63d0807b975 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -60,6 +60,11 @@
- When calling UNLOCK TABLES we call mysql_unlock_tables() for all
tables used in LOCK TABLES
+ If table_handler->external_lock(thd, locktype) fails, we call
+ table_handler->external_lock(thd, F_UNLCK) for each table that was locked,
+ excluding one that caused failure. That means handler must cleanup itself
+ in case external_lock() fails.
+
TODO:
Change to use my_malloc() ONLY when using LOCK TABLES command or when
we are forced to use mysql_lock_merge.
@@ -269,8 +274,9 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
if ((error=(*tables)->file->ha_external_lock(thd,lock_type)))
{
print_lock_error(error, (*tables)->file->table_type());
- for (; i-- ; tables--)
+ while (--i)
{
+ tables--;
(*tables)->file->ha_external_lock(thd, F_UNLCK);
(*tables)->current_lock=F_UNLCK;
}