mirror of
https://github.com/MariaDB/server.git
synced 2025-01-25 00:04:33 +01:00
ha_innobase::store_lock(): When downgrading table locks, do not
check thd->in_lock_tables but test if thd->lex->sql_command == SQLCOM_LOCK_TABLES instead. Otherwise, stored functions will use table locks. (Bug #18077) This patch is from Heikki.
This commit is contained in:
parent
176296e7ce
commit
14fed4b06e
1 changed files with 5 additions and 4 deletions
|
@ -6812,7 +6812,8 @@ ha_innobase::store_lock(
|
|||
&& lock_type != TL_IGNORE)) {
|
||||
|
||||
/* The OR cases above are in this order:
|
||||
1) MySQL is doing LOCK TABLES ... READ LOCAL, or
|
||||
1) MySQL is doing LOCK TABLES ... READ LOCAL, or we
|
||||
are processing a stored procedure or function, or
|
||||
2) (we do not know when TL_READ_HIGH_PRIORITY is used), or
|
||||
3) this is a SELECT ... IN SHARE MODE, or
|
||||
4) we are doing a complex SQL statement like
|
||||
|
@ -6880,7 +6881,8 @@ ha_innobase::store_lock(
|
|||
single transaction stored procedure call deterministic
|
||||
(if it does not use a consistent read). */
|
||||
|
||||
if (lock_type == TL_READ && thd->in_lock_tables) {
|
||||
if (lock_type == TL_READ
|
||||
&& thd->lex->sql_command == SQLCOM_LOCK_TABLES) {
|
||||
/* We come here if MySQL is processing LOCK TABLES
|
||||
... READ LOCAL. MyISAM under that table lock type
|
||||
reads the table as it was at the time the lock was
|
||||
|
@ -6939,8 +6941,7 @@ ha_innobase::store_lock(
|
|||
(MySQL does have thd->in_lock_tables TRUE there). */
|
||||
|
||||
if (lock_type == TL_READ_NO_INSERT
|
||||
&& (!thd->in_lock_tables
|
||||
|| thd->lex->sql_command == SQLCOM_CALL)) {
|
||||
&& thd->lex->sql_command != SQLCOM_LOCK_TABLES) {
|
||||
|
||||
lock_type = TL_READ;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue