diff --git a/mysql-test/suite/innodb/r/lock_isolation.result b/mysql-test/suite/innodb/r/lock_isolation.result index 1ddb9deb24c..5975b531451 100644 --- a/mysql-test/suite/innodb/r/lock_isolation.result +++ b/mysql-test/suite/innodb/r/lock_isolation.result @@ -134,8 +134,10 @@ BEGIN; INSERT INTO t SET a=2; connection consistent; START TRANSACTION WITH CONSISTENT SNAPSHOT; +SAVEPOINT sp1; SELECT * FROM t FORCE INDEX (b) FOR UPDATE; ERROR HY000: Record has changed since last read in table 't' +SAVEPOINT sp1; connection con_weird; START TRANSACTION WITH CONSISTENT SNAPSHOT; SELECT * FROM t FORCE INDEX (b) FOR UPDATE; @@ -155,3 +157,4 @@ a b disconnect consistent; connection default; DROP TABLE t; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/lock_isolation.test b/mysql-test/suite/innodb/t/lock_isolation.test index 4e44cea8c2e..c9658c0a362 100644 --- a/mysql-test/suite/innodb/t/lock_isolation.test +++ b/mysql-test/suite/innodb/t/lock_isolation.test @@ -152,10 +152,12 @@ BEGIN; INSERT INTO t SET a=2; --connection consistent START TRANSACTION WITH CONSISTENT SNAPSHOT; +SAVEPOINT sp1; --disable_ps2_protocol --error ER_CHECKREAD SELECT * FROM t FORCE INDEX (b) FOR UPDATE; --enable_ps2_protocol +SAVEPOINT sp1; --connection con_weird START TRANSACTION WITH CONSISTENT SNAPSHOT; @@ -181,3 +183,5 @@ SELECT * FROM t FORCE INDEX (b) FOR UPDATE; --connection default DROP TABLE t; + +--echo # End of 10.6 tests diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a07031c4554..77c3d93147b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2234,6 +2234,7 @@ convert_error_code_to_mysql( return(HA_ERR_NO_ACTIVE_RECORD); case DB_DEADLOCK: + case DB_RECORD_CHANGED: /* Since we rolled back the whole transaction, we must tell it also to MySQL so that MySQL knows to empty the cached binlog for this transaction */ @@ -2242,10 +2243,8 @@ convert_error_code_to_mysql( thd_mark_transaction_to_rollback(thd, 1); } - return(HA_ERR_LOCK_DEADLOCK); - - case DB_RECORD_CHANGED: - return HA_ERR_RECORD_CHANGED; + return error == DB_DEADLOCK + ? HA_ERR_LOCK_DEADLOCK : HA_ERR_RECORD_CHANGED; case DB_LOCK_WAIT_TIMEOUT: /* Starting from 5.0.13, we let MySQL just roll back the