Skip to content

Commit ce1c957

Browse files
committed
Speed up the test innodb.lock_insert_into_empty
Let us use innodb_lock_wait_timeout=0 for an immediate timeout. Also, do not override the timeout in the default connection, so that further tests will use the default setting.
1 parent add782a commit ce1c957

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

mysql-test/suite/innodb/r/lock_insert_into_empty.result

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@ BEGIN;
55
DELETE FROM t1;
66
INSERT INTO t2 VALUES(1),(1);
77
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
8-
connect con1,localhost,root,,;
98
BEGIN;
109
SELECT * FROM t2 LOCK IN SHARE MODE;
1110
a
12-
connection default;
13-
SET innodb_lock_wait_timeout=1;
11+
connect con1,localhost,root,,;
12+
SET innodb_lock_wait_timeout=0;
1413
INSERT INTO t2 VALUES(2);
1514
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
16-
disconnect con1;
15+
connection default;
16+
ROLLBACK;
17+
connection con1;
1718
INSERT INTO t2 VALUES(3);
1819
COMMIT;
20+
disconnect con1;
21+
connection default;
1922
SELECT * FROM t1;
2023
a
2124
SELECT * FROM t2;
@@ -45,7 +48,7 @@ INSERT INTO t1 SET k=1;
4548
START TRANSACTION;
4649
INSERT INTO t1 SET k=2;
4750
connect con1,localhost,root,,test;
48-
SET innodb_lock_wait_timeout= 1;
51+
SET innodb_lock_wait_timeout=0;
4952
CREATE TABLE t2 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB
5053
AS SELECT k FROM t1;
5154
ERROR HY000: Lock wait timeout exceeded; try restarting transaction

mysql-test/suite/innodb/t/lock_insert_into_empty.test

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ DELETE FROM t1;
99
--error ER_DUP_ENTRY
1010
INSERT INTO t2 VALUES(1),(1);
1111

12-
connect (con1,localhost,root,,);
1312
BEGIN;
1413
SELECT * FROM t2 LOCK IN SHARE MODE;
1514

16-
connection default;
17-
SET innodb_lock_wait_timeout=1;
15+
connect (con1,localhost,root,,);
16+
SET innodb_lock_wait_timeout=0;
1817
--error ER_LOCK_WAIT_TIMEOUT
1918
INSERT INTO t2 VALUES(2);
20-
disconnect con1;
19+
connection default;
20+
ROLLBACK;
21+
connection con1;
2122
INSERT INTO t2 VALUES(3);
2223
COMMIT;
24+
disconnect con1;
25+
connection default;
2326

2427
SELECT * FROM t1;
2528
SELECT * FROM t2;
@@ -50,7 +53,7 @@ START TRANSACTION;
5053
INSERT INTO t1 SET k=2;
5154

5255
--connect (con1,localhost,root,,test)
53-
SET innodb_lock_wait_timeout= 1;
56+
SET innodb_lock_wait_timeout=0;
5457
--error ER_LOCK_WAIT_TIMEOUT
5558
CREATE TABLE t2 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB
5659
AS SELECT k FROM t1;

0 commit comments

Comments
 (0)