diff options
author | unknown <marko@hundin.mysql.fi> | 2004-05-31 16:33:45 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-05-31 16:33:45 +0300 |
commit | fec8faa06a4f9b167e3cad9ac31cdf05bc4025e0 (patch) | |
tree | d0fc17f7ba674317b73d126eb4e7c35ca1d8481e | |
parent | ea21baa5bff9bec4cbc460499d2563cd3ca427a0 (diff) | |
download | mariadb-git-fec8faa06a4f9b167e3cad9ac31cdf05bc4025e0.tar.gz |
InnoDB: Do not get a lock for consistent reads (Bug #3894)
sql/ha_innodb.cc:
start_stmt(): Obtain an exclusive lock for other than plain SELECT
-rw-r--r-- | sql/ha_innodb.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index dee34b47ccb..e09a5e20d34 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -4504,6 +4504,17 @@ ha_innobase::start_stmt( prepared for an update of a row */ prebuilt->select_lock_type = LOCK_X; + } else { + /* For other than temporary tables, we obtain + no lock for consistent read (plain SELECT), and + an exclusive lock for SELECT ... FOR UPDATE or + SELECT ... LOCK IN SHARE MODE. */ + + prebuilt->select_lock_type = + thd->lex.sql_command == SQLCOM_SELECT + && thd->lex.lock_option == TL_READ + ? LOCK_NONE + : LOCK_X; } /* Set the MySQL flag to mark that there is an active transaction */ |