3
# Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections
6
--source include/not_embedded.inc
7
--source include/have_innodb.inc
9
let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1);
10
if (`SELECT $innodb_lock_wait_timeout < 10`)
12
--echo # innodb_lock_wait_timeout must be >= 10 seconds
13
--echo # so that this test can work all time fine on an overloaded testing box
14
SHOW VARIABLES LIKE 'innodb_lock_wait_timeout';
18
# Save the initial number of concurrent sessions
19
--source include/count_sessions.inc
26
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
28
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
32
CREATE TEMPORARY TABLE t1_tmp ( b INT );
34
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
35
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
38
connect (user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK);
42
CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
43
INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
45
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
47
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
49
# The last update will wait for a lock held by the first session
54
# Poll till the UPDATE of the second session waits for lock
55
let $show_statement= SHOW PROCESSLIST;
57
let $condition= = 'Updating';
58
--source include/wait_show_condition.inc
60
# If the testing box is overloadeded and innodb_lock_wait_timeout is too small
61
# we might get here ER_LOCK_WAIT_TIMEOUT.
62
--error ER_LOCK_DEADLOCK
63
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
67
--echo Reap the server message for connection user2 UPDATE t1 ...
70
# The server crashed when executing this UPDATE or the succeeding SQL command.
71
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
77
# Wait till all disconnects are completed
78
--source include/wait_until_count_sessions.inc