--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