I checked the test failures:
CURRENT_TEST: innodb.innodb_bug14007649
|
mysqltest: At line 42: query 'update t1 set f2 = 6 where f1 = 1 and f2 is null' failed: ER_LOCK_DEADLOCK (1213): Deadlock found when trying to get lock; try restarting transaction
|
The record had been inserted by connection b at line 29, insert into t1 values (3, 1, null). The transaction was started and committed after between start transaction with consistent snapshot and the failure in connection a. This test needs to be adjusted, or maybe removed.
CURRENT_TEST: innodb.innodb_timeout_rollback
|
mysqltest: In included file "./include/innodb_rollback_on_timeout.inc":
|
included from /mariadb/10.6/mysql-test/suite/innodb/t/innodb_timeout_rollback.test at line 3:
|
At line 29: query 'insert into t1 values (2)' failed with wrong errno ER_LOCK_DEADLOCK (1213): 'Deadlock found when trying to get lock; try restarting transaction', instead of ER_LOCK_WAIT_TIMEOUT (1205)...
|
The INSERT in con2 was not committed yet, so it will not be in the read view of con1. We could avoid this test failure if the patch didn’t validate the visibility before waiting for the lock (which would time out). Better, we could simply remove the read view creation from con1 to make the test pass:
diff --git a/mysql-test/include/innodb_rollback_on_timeout.inc b/mysql-test/include/innodb_rollback_on_timeout.inc
|
index 274bbe12566..883b0820589 100644
|
--- a/mysql-test/include/innodb_rollback_on_timeout.inc
|
+++ b/mysql-test/include/innodb_rollback_on_timeout.inc
|
@@ -22,7 +22,6 @@ select * from t1;
|
connection con1;
|
begin work;
|
insert into t1 values (5);
|
-select * from t1;
|
# Lock wait timeout set to 2 seconds in <THIS TEST>-master.opt; this
|
# statement will time out; in 5.0.13+, it will not roll back transaction.
|
--error ER_LOCK_WAIT_TIMEOUT
|
CURRENT_TEST: gcol.innodb_virtual_debug_purge
|
mysqltest: At line 151: query 'DELETE FROM t1 WHERE a = 3' failed: ER_LOCK_DEADLOCK (1213): Deadlock found when trying to get lock; try restarting transaction
|
The record had been modified by DELETE FROM t1 WHERE a = 1 in connection default in line 139. The fix is simple: we do not actually need a read view in this transaction:
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test
|
index 09fba0285c7..7966953535c 100644
|
--- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test
|
+++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test
|
@@ -131,9 +131,8 @@ CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b));
|
|
INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3), (4, 4);
|
|
-connection con1;
|
---echo # disable purge
|
-BEGIN; SELECT * FROM t0;
|
+connect (stop_purge,localhost,root,,);
|
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
|
connection default;
|
DELETE FROM t1 WHERE a = 1;
|
@@ -148,13 +147,14 @@ send ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE;
|
connection con1;
|
SET DEBUG_SYNC= 'now WAIT_FOR uncommitted';
|
|
+BEGIN;
|
DELETE FROM t1 WHERE a = 3;
|
|
UPDATE t1 SET a = 7, b = 7 WHERE a = 4;
|
|
INSERT INTO t1(a, b) VALUES (8, 8);
|
|
---echo # enable purge
|
+disconnect stop_purge;
|
COMMIT;
|
|
--echo # wait for purge to process the deleted/updated records.
|
CURRENT_TEST: innodb.innodb-isolation
|
mysqltest: At line 156: query 'SELECT c1, c2 FROM t1 WHERE c1 < ((SELECT COUNT(*) FROM t1) / 2) FOR UPDATE' failed with wrong errno ER_LOCK_DEADLOCK (1213): 'Deadlock found when trying to get lock; try restarting transaction', instead of ER_LOCK_WAIT_TIMEOUT (1205)...
|
The record had been modified by UPDATE t1 SET c2 = c2 * 3 WHERE c1 = 1 in line 51 in the default connection. This transaction is still open. This test would need to be shrunk or removed to adjust for the code change.
CURRENT_TEST: main.deadlock_innodb
|
mysqltest: In included file "./include/deadlock.inc":
|
included from /mariadb/10.6/mysql-test/main/deadlock_innodb.test at line 17:
|
At line 117: query 'reap' failed: ER_LOCK_DEADLOCK (1213): Deadlock found when trying to get lock; try restarting transaction
|
The record had been modified by update t1 set x=1 where id = 0 in line 112. The fix is to avoid creating a read view:
diff --git a/mysql-test/include/deadlock.inc b/mysql-test/include/deadlock.inc
|
index abf217aea75..362d456e3f2 100644
|
--- a/mysql-test/include/deadlock.inc
|
+++ b/mysql-test/include/deadlock.inc
|
@@ -103,7 +103,6 @@ connection con2;
|
|
# The following query should hang because con1 is locking the record
|
update t2 set a=2 where b = 0;
|
-select * from t2;
|
--send
|
update t1 set x=2 where id = 0;
|
--sleep 2
|
CURRENT_TEST: innodb.innodb_mysql
|
mysqltest: In included file "./include/innodb_rollback_on_timeout.inc":
|
included from ./include/mix1.inc at line 482:
|
included from /mariadb/10.6/mysql-test/suite/innodb/t/innodb_mysql.test at line 19:
|
At line 29: query 'insert into t1 values (2)' failed with wrong errno ER_LOCK_DEADLOCK (1213): 'Deadlock found when trying to get lock; try restarting transaction', instead of ER_LOCK_WAIT_TIMEOUT (1205)...
|
This is fixed by removing a read view creation (the same fix as innodb.innodb_timeout_rollback).
I pushed this for some initial testing. If everything goes as expected, pre-built packages of this change should be available in https://ci.mariadb.org/42468/ within an hour or two.
This bug can also be reproduced in MySQL8.2.0 and has been verified by MySQL Verification Team. mysql# #113228