summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-02-05 13:39:46 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-02-05 13:39:46 +0400
commit2be07c70947924c9829ad58dd1ee9d1f4228c401 (patch)
tree8c27cb07e2a58d8e61bdb095b1be1de3bc22a392
parent128c9be664caa06142ad299c1a3bf17426468a65 (diff)
downloadmariadb-git-2be07c70947924c9829ad58dd1ee9d1f4228c401.tar.gz
Bug#47736 killing a select from a view when the view is processing a function, asserts
hide_view_error() does not take into account that thread query may be killed. Added a check for thd->killed. Addon: backported bug32140 fix from 6.0 mysql-test/r/sp_notembedded.result: test case mysql-test/t/sp_notembedded.test: test case sql/sp.cc: backported bug32140 fix from 6.0 sql/table.cc: Added a check for thd->killed.
-rw-r--r--mysql-test/r/sp_notembedded.result11
-rw-r--r--mysql-test/t/sp_notembedded.test37
-rw-r--r--sql/sp.cc4
-rw-r--r--sql/table.cc2
4 files changed, 53 insertions, 1 deletions
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index 831616f491b..7e9ccf01d23 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -268,6 +268,17 @@ SELECT RELEASE_LOCK('Bug44521');
RELEASE_LOCK('Bug44521')
1
DROP PROCEDURE p;
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1);
+CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60);
+CREATE VIEW v1 AS SELECT f1('a') FROM t1;
+SELECT * FROM v1;;
+SELECT * FROM v1;
+ERROR 70100: Query execution was interrupted
+ERROR 70100: Query execution was interrupted
+DROP VIEW v1;
+DROP TABLE t1;
+DROP FUNCTION f1;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index f593e184ad2..326cc22f1cd 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -413,6 +413,43 @@ let $wait_condition=
--source include/wait_condition.inc
DROP PROCEDURE p;
+#
+# Bug#47736 killing a select from a view when the view is processing a function, asserts
+#
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1);
+CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60);
+CREATE VIEW v1 AS SELECT f1('a') FROM t1;
+
+--connect (con1, localhost, root,,)
+--let $ID_1= `SELECT connection_id()`
+--send SELECT * FROM v1;
+
+--connect (con2, localhost, root,,)
+--let $ID_2= `SELECT connection_id()`
+--send SELECT * FROM v1
+
+--connection default
+--disable_query_log
+--eval KILL QUERY $ID_2
+--eval KILL QUERY $ID_1
+--enable_query_log
+
+--connection con1
+--error ER_QUERY_INTERRUPTED
+--reap
+--connection con2
+--error ER_QUERY_INTERRUPTED
+--reap
+
+--connection default
+DROP VIEW v1;
+DROP TABLE t1;
+DROP FUNCTION f1;
+--disconnect con1
+--disconnect con2
+
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------
diff --git a/sql/sp.cc b/sql/sp.cc
index f0508142557..ef69edb96c6 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1898,6 +1898,10 @@ sp_cache_routines_and_add_tables_aux(THD *thd, LEX *lex,
ret= SP_OK;
break;
default:
+ /* Query might have been killed, don't set error. */
+ if (thd->killed)
+ break;
+
/*
Any error when loading an existing routine is either some problem
with the mysql.proc table, or a parse error because the contents
diff --git a/sql/table.cc b/sql/table.cc
index c06ecf99926..8a8228b9954 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -3365,7 +3365,7 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type)
void TABLE_LIST::hide_view_error(THD *thd)
{
- if (thd->get_internal_handler())
+ if (thd->killed || thd->get_internal_handler())
return;
/* Hide "Unknown column" or "Unknown function" error */
DBUG_ASSERT(thd->is_error());