diff options
author | unknown <jan@hundin.mysql.fi> | 2005-02-08 09:36:36 +0200 |
---|---|---|
committer | unknown <jan@hundin.mysql.fi> | 2005-02-08 09:36:36 +0200 |
commit | 6cee60ea260384763fb54b6cf651f518726488d2 (patch) | |
tree | 609111a34300e492ce5031b8fe4b79a4d40c93fa /sql/ha_innodb.cc | |
parent | 5be12eba73269ddbcc7e14f1207a8fc1b6d44aaa (diff) | |
download | mariadb-git-6cee60ea260384763fb54b6cf651f518726488d2.tar.gz |
Relaxed locking in INSERT...SELECT, single table UPDATE...SELECT and
single table DELETE...SELECT clauses when innobase_locks_unsafe_for_binlog
is used and isolation level of the transaction is not serializable.
InnoDB uses consistent read in these cases for a selected table.
Backported from 5.0.x.
sql/ha_innodb.cc:
Relaxed locking in INSERT...SELECT, single table UPDATE...SELECT and
single table DELETE...SELECT clauses when innobase_locks_unsafe_for_binlog
is used and isolation level of the transaction is not serializable.
InnoDB uses consistent read in these cases for a selected table.
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r-- | sql/ha_innodb.cc | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 1d75ce99aee..702139624ff 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5282,8 +5282,27 @@ ha_innobase::store_lock( are not simple SELECTs; note that select_lock_type in this case may get strengthened in ::external_lock() to LOCK_X. */ - prebuilt->select_lock_type = LOCK_S; - prebuilt->stored_select_lock_type = LOCK_S; + if (srv_locks_unsafe_for_binlog && + prebuilt->trx->isolation_level != TRX_ISO_SERIALIZABLE && + (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && + thd->lex->sql_command != SQLCOM_SELECT && + thd->lex->sql_command != SQLCOM_UPDATE_MULTI && + thd->lex->sql_command != SQLCOM_DELETE_MULTI ) { + + /* In case we have innobase_locks_unsafe_for_binlog + option set and isolation level of the transaction + is not set to serializable and MySQL is doing + INSERT INTO...SELECT without FOR UPDATE or IN + SHARE MODE we use consistent read for select. + Similarly, in case of DELETE...SELECT and + UPDATE...SELECT when these are not multi table.*/ + + prebuilt->select_lock_type = LOCK_NONE; + prebuilt->stored_select_lock_type = LOCK_NONE; + } else { + prebuilt->select_lock_type = LOCK_S; + prebuilt->stored_select_lock_type = LOCK_S; + } } else if (lock_type != TL_IGNORE) { |