summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <tsmith/tim@siva.hindu.god>2006-10-20 12:34:31 -0600
committerunknown <tsmith/tim@siva.hindu.god>2006-10-20 12:34:31 -0600
commit7c7ea371cd6190307f7c7f1a8e59729feefb864b (patch)
tree2887515057082ea005ecf52ba6ec5ae85bf08bc2
parent665d169243f6641d0f1a3c33d6dde6c64973ae44 (diff)
downloadmariadb-git-7c7ea371cd6190307f7c7f1a8e59729feefb864b.tar.gz
Apply InnoDB snapshot ss923
Fixes: - Bug #18077: InnoDB uses full explicit table locks in stored FUNCTION sql/ha_innodb.cc: Apply InnoDB snapshot ss923 Revision r922: 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)
-rw-r--r--sql/ha_innodb.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index e99d93784c9..e018ad8a3b4 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -6563,7 +6563,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
@@ -6625,7 +6626,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
@@ -6684,8 +6686,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;
}