Commit df5ec8b2 authored by jan's avatar jan

Merge r357 from branches/5.0: Fix bug #18350 Use consistent read in

CREATE ... SELECT... if innodb_locks_unsafe_for_binlog is used. 
This patch is from Heikki.
parent ea96a298
...@@ -6898,18 +6898,20 @@ ha_innobase::store_lock( ...@@ -6898,18 +6898,20 @@ ha_innobase::store_lock(
unexpected if an obsolete consistent read view would be unexpected if an obsolete consistent read view would be
used. */ used. */
if (srv_locks_unsafe_for_binlog && if (srv_locks_unsafe_for_binlog
prebuilt->trx->isolation_level != TRX_ISO_SERIALIZABLE && && prebuilt->trx->isolation_level != TRX_ISO_SERIALIZABLE
(lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && && (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
(thd->lex->sql_command == SQLCOM_INSERT_SELECT || && (thd->lex->sql_command == SQLCOM_INSERT_SELECT
thd->lex->sql_command == SQLCOM_UPDATE)) { || thd->lex->sql_command == SQLCOM_UPDATE
|| thd->lex->sql_command == SQLCOM_CREATE_TABLE)) {
/* In case we have innobase_locks_unsafe_for_binlog /* In case we have innobase_locks_unsafe_for_binlog
option set and isolation level of the transaction option set and isolation level of the transaction
is not set to serializable and MySQL is doing is not set to serializable and MySQL is doing
INSERT INTO...SELECT or UPDATE ... = (SELECT ...) INSERT INTO...SELECT or UPDATE ... = (SELECT ...) or
without FOR UPDATE or IN SHARE MODE in select, then CREATE ... SELECT... without FOR UPDATE or
we use consistent read for select. */ IN SHARE MODE in select, then we use consistent
read for select. */
prebuilt->select_lock_type = LOCK_NONE; prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = LOCK_NONE; prebuilt->stored_select_lock_type = LOCK_NONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment