summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2004-12-22 11:11:16 +0200
committerunknown <heikki@hundin.mysql.fi>2004-12-22 11:11:16 +0200
commitef1971ecb153e3a5e26e20018fdccdc8220780dd (patch)
tree559413f41b2904cb2df4fadfc2ff1118f7bb4ed9 /sql/ha_innodb.cc
parent6fa467666d69ecda10333a17b008ddfc0a1b26ea (diff)
downloadmariadb-git-ef1971ecb153e3a5e26e20018fdccdc8220780dd.tar.gz
ha_innodb.cc:
Add a comment that no InnoDB table lock is now acquired in LOCK TABLES if AUTOCOMMIT=1. This helps to avoid deadlocks when porting old MyISAM applications to InnoDB. sql/ha_innodb.cc: Add a comment that no InnoDB table lock is now acquired in LOCK TABLES if AUTOCOMMIT=1. This helps to avoid deadlocks when porting old MyISAM applications to InnoDB.
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 20837e2172d..552f2676bdd 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -5049,10 +5049,18 @@ ha_innobase::external_lock(
prebuilt->select_lock_type = LOCK_S;
}
+ /* Starting from 4.1.9, no InnoDB table lock is taken in LOCK
+ TABLES if AUTOCOMMIT=1. It does not make much sense to acquire
+ an InnoDB table lock if it is released immediately at the end
+ of LOCK TABLES, and InnoDB's table locks in that case cause
+ VERY easily deadlocks. */
+
if (prebuilt->select_lock_type != LOCK_NONE) {
+
if (thd->in_lock_tables &&
thd->variables.innodb_table_locks &&
(thd->options & OPTION_NOT_AUTOCOMMIT)) {
+
ulint error;
error = row_lock_table_for_mysql(prebuilt,
NULL, LOCK_TABLE_EXP);