summaryrefslogtreecommitdiff
path: root/mysql-test/t/kill.test
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-05-31 12:10:21 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-05-31 12:10:21 +0500
commitebedff7775b86974cd108ce85c348ec95a026671 (patch)
treed6acf3462e12c559ab31984045f75d1046796dee /mysql-test/t/kill.test
parentd7a90fa1724a047d8b9cf81e974c39a9ae64ff84 (diff)
downloadmariadb-git-ebedff7775b86974cd108ce85c348ec95a026671.tar.gz
Fixed bug #28598.
mysqld crashed when a long-running explain query was killed from another connection. When the current thread caught a kill signal executing the function best_extension_by_limited_search it just silently returned to the calling function greedy_search without initializing elements of the join->best_positions array. However, the greedy_search function ignored thd->killed status after a calls to the best_extension_by_limited_search function, and after several calls the greedy_search function used an uninitialized data from the join->best_positions[idx] to search position in the join->best_ref array. That search failed, and greedy_search tried to call swap_variables function with NULL argument - that caused a crash. sql/sql_select.cc: Fixed bug #28598. choose_plan(), greedy_search(), best_extension_by_limited_search() and find_best() functions have been changed to return TRUE in case of fatal error. mysql-test/t/kill.test: Updated test case for bug #28598. mysql-test/r/kill.result: Updated test case for bug #28598.
Diffstat (limited to 'mysql-test/t/kill.test')
-rw-r--r--mysql-test/t/kill.test53
1 files changed, 53 insertions, 0 deletions
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 83194e214fb..5f6bae00254 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -249,3 +249,56 @@ select release_lock("lock27563");
drop table t1, t2;
drop function bug27563;
drop procedure proc27563;
+
+#
+# Bug#28598: mysqld crash when killing a long-running explain query.
+#
+--disable_query_log
+connection con1;
+let $ID= `select connection_id()`;
+let $tab_count= 40;
+
+let $i= $tab_count;
+while ($i)
+{
+ eval CREATE TABLE t$i (a$i int, KEY(a$i));
+ eval INSERT INTO t$i VALUES (1),(2),(3),(4),(5),(6),(7);
+ dec $i ;
+}
+set session optimizer_search_depth=0;
+
+let $i=$tab_count;
+while ($i)
+{
+ let $a= a$i;
+ let $t= t$i;
+ dec $i;
+ if ($i)
+ {
+ let $comma=,;
+ let $from=$comma$t$from;
+ let $where=a$i=$a $and $where;
+ }
+ if (!$i)
+ {
+ let $from=FROM $t$from;
+ let $where=WHERE $where;
+ }
+ let $and=AND;
+}
+
+--enable_query_log
+eval PREPARE stmt FROM 'EXPLAIN SELECT * $from $where';
+send EXECUTE stmt;
+--disable_query_log
+
+connection con2;
+real_sleep 2;
+eval kill query $ID;
+let $i= $tab_count;
+while ($i)
+{
+ eval DROP TABLE t$i;
+ dec $i ;
+}
+--enable_query_log