Commit ef1971ec authored by unknown's avatar unknown
Browse files

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
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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);