summaryrefslogtreecommitdiff
path: root/mysql-test/t/with_recursive_kill.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/with_recursive_kill.test')
-rw-r--r--mysql-test/t/with_recursive_kill.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/mysql-test/t/with_recursive_kill.test b/mysql-test/t/with_recursive_kill.test
new file mode 100644
index 00000000000..36da35c09db
--- /dev/null
+++ b/mysql-test/t/with_recursive_kill.test
@@ -0,0 +1,45 @@
+-- source include/have_debug_sync.inc
+-- source include/not_threadpool.inc
+
+connect (con1, localhost, root,,);
+connect (con2, localhost, root,,);
+
+# Save id of con1
+connection con1;
+--disable_reconnect
+let $ID= `SELECT @id := CONNECTION_ID()`;
+connection con2;
+let $ignore= `SELECT @id := $ID`;
+
+--echo # Test that infinite WITH RECURSIVE can be killed
+connection con1;
+
+SET DEBUG_SYNC='in_WITH_RECURSIVE SIGNAL with_recursive_has_started';
+
+send
+with recursive q (num, mark) as (
+ select 1, "a"
+ union all select 1+num, "b" from q where mark="a"
+ union all select 1+num, "a" from q where mark="b"
+)
+select num from q;
+
+connection con2;
+
+# Wait until the above SELECT is in WITH-RECURSIVE algorithm
+SET DEBUG_SYNC='now WAIT_FOR with_recursive_has_started';
+
+KILL QUERY @id;
+connection con1;
+--error ER_QUERY_INTERRUPTED
+reap;
+SET DEBUG_SYNC= 'RESET';
+SELECT 1;
+
+connection con2;
+SET DEBUG_SYNC= 'RESET';
+
+connection con1;
+connection default;
+disconnect con1;
+disconnect con2;