1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
--source include/have_debug.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo #
--echo # Bug#31016076 SELECT COUNT(*) ON LARGE TABLE HANG FOREVER EVEN AFTER CTRL+C
--echo #
DELIMITER |;
CREATE PROCEDURE populate_t1(IN BASE INT, IN SIZE INT)
BEGIN
DECLARE i INT DEFAULT BASE;
WHILE (i <= SIZE) DO
INSERT INTO t1(f2, f3) values (i, i);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
CREATE TABLE t1(
f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 INT NOT NULL,
f3 INT NOT NULL)
ENGINE=INNODB;
let $counter = 1;
let $max_counter=9;
while($counter < $max_counter){
connect (c$counter, localhost, root,,);
inc $counter;
}
--disable_query_log
--echo # Create 150000 uncommitted rows
let $counter = 1;
let $base=1;
# Each of 8 connections creates 18750 records
let $size = 18750;
while($counter < $max_counter) {
connection c$counter;
BEGIN;
send_eval CALL populate_t1($base, $size);
connection default;
let $base = `SELECT $base + $size`;
inc $counter;
}
let $counter = 1;
while($counter < $max_counter) {
connection c$counter;
reap;
inc $counter;
}
--enable_query_log
connect (con1,localhost,root,,);
connection con1;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
# To make the select slow
SET SESSION innodb_parallel_read_threads=2;
let $ID= `SELECT @id := CONNECTION_ID()`;
--echo # Count committed rows
SET DEBUG_SYNC='parallel_read_wait_for_kill_query SIGNAL ready WAIT_FOR kill_query';
--send SELECT count(*) FROM t1
connection default;
SET DEBUG_SYNC='now WAIT_FOR ready';
SET DEBUG_SYNC='now SIGNAL kill_query';
--echo # Killing select query
let $ignore= `SELECT @id := $ID`;
kill query @id;
# Wait 1 second for select to be aborted
--sleep 1
--echo # Should be 0 since the query should not be active
SELECT COUNT(*) FROM information_schema.processlist WHERE id = @id AND
INFO = 'SELECT count(*) FROM t1' AND state="executing";
connection con1;
--error ER_QUERY_INTERRUPTED
--reap
--disable_query_log
let $counter = 1;
while($counter < $max_counter){
connection c$counter;
COMMIT;
disconnect c$counter;
inc $counter;
}
--enable_query_log
--echo # Cleanup
connection default;
SET DEBUG_SYNC="RESET";
DROP PROCEDURE populate_t1;
DROP TABLE t1;
disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
|