mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-35235 innodb_snapshot_isolation=ON fails to signal transaction rollback
convert_error_code_to_mysql(): Treat DB_DEADLOCK and DB_RECORD_CHANGED in the same way, that is, signal to the SQL layer that the transaction had been rolled back.
This commit is contained in:
@ -134,8 +134,10 @@ BEGIN;
|
|||||||
INSERT INTO t SET a=2;
|
INSERT INTO t SET a=2;
|
||||||
connection consistent;
|
connection consistent;
|
||||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||||
|
SAVEPOINT sp1;
|
||||||
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
|
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
|
||||||
ERROR HY000: Record has changed since last read in table 't'
|
ERROR HY000: Record has changed since last read in table 't'
|
||||||
|
SAVEPOINT sp1;
|
||||||
connection con_weird;
|
connection con_weird;
|
||||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||||
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
|
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
|
||||||
@ -155,3 +157,4 @@ a b
|
|||||||
disconnect consistent;
|
disconnect consistent;
|
||||||
connection default;
|
connection default;
|
||||||
DROP TABLE t;
|
DROP TABLE t;
|
||||||
|
# End of 10.6 tests
|
||||||
|
@ -152,10 +152,12 @@ BEGIN; INSERT INTO t SET a=2;
|
|||||||
|
|
||||||
--connection consistent
|
--connection consistent
|
||||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||||
|
SAVEPOINT sp1;
|
||||||
--disable_ps2_protocol
|
--disable_ps2_protocol
|
||||||
--error ER_CHECKREAD
|
--error ER_CHECKREAD
|
||||||
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
|
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
|
||||||
--enable_ps2_protocol
|
--enable_ps2_protocol
|
||||||
|
SAVEPOINT sp1;
|
||||||
|
|
||||||
--connection con_weird
|
--connection con_weird
|
||||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||||
@ -181,3 +183,5 @@ SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
|
|||||||
|
|
||||||
--connection default
|
--connection default
|
||||||
DROP TABLE t;
|
DROP TABLE t;
|
||||||
|
|
||||||
|
--echo # End of 10.6 tests
|
||||||
|
@ -2234,6 +2234,7 @@ convert_error_code_to_mysql(
|
|||||||
return(HA_ERR_NO_ACTIVE_RECORD);
|
return(HA_ERR_NO_ACTIVE_RECORD);
|
||||||
|
|
||||||
case DB_DEADLOCK:
|
case DB_DEADLOCK:
|
||||||
|
case DB_RECORD_CHANGED:
|
||||||
/* Since we rolled back the whole transaction, we must
|
/* Since we rolled back the whole transaction, we must
|
||||||
tell it also to MySQL so that MySQL knows to empty the
|
tell it also to MySQL so that MySQL knows to empty the
|
||||||
cached binlog for this transaction */
|
cached binlog for this transaction */
|
||||||
@ -2242,10 +2243,8 @@ convert_error_code_to_mysql(
|
|||||||
thd_mark_transaction_to_rollback(thd, 1);
|
thd_mark_transaction_to_rollback(thd, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(HA_ERR_LOCK_DEADLOCK);
|
return error == DB_DEADLOCK
|
||||||
|
? HA_ERR_LOCK_DEADLOCK : HA_ERR_RECORD_CHANGED;
|
||||||
case DB_RECORD_CHANGED:
|
|
||||||
return HA_ERR_RECORD_CHANGED;
|
|
||||||
|
|
||||||
case DB_LOCK_WAIT_TIMEOUT:
|
case DB_LOCK_WAIT_TIMEOUT:
|
||||||
/* Starting from 5.0.13, we let MySQL just roll back the
|
/* Starting from 5.0.13, we let MySQL just roll back the
|
||||||
|
Reference in New Issue
Block a user