Commit ef1971ec authored by unknown's avatar unknown

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.
parent 6fa46766
...@@ -5049,10 +5049,18 @@ ha_innobase::external_lock( ...@@ -5049,10 +5049,18 @@ ha_innobase::external_lock(
prebuilt->select_lock_type = LOCK_S; 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 (prebuilt->select_lock_type != LOCK_NONE) {
if (thd->in_lock_tables && if (thd->in_lock_tables &&
thd->variables.innodb_table_locks && thd->variables.innodb_table_locks &&
(thd->options & OPTION_NOT_AUTOCOMMIT)) { (thd->options & OPTION_NOT_AUTOCOMMIT)) {
ulint error; ulint error;
error = row_lock_table_for_mysql(prebuilt, error = row_lock_table_for_mysql(prebuilt,
NULL, LOCK_TABLE_EXP); NULL, LOCK_TABLE_EXP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment