diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-03-09 09:51:56 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-03-09 09:51:56 -0300 |
commit | ed92f9154966401934712d123d9d9c6e71e00e3c (patch) | |
tree | abecc2969c3c169410aa89921271b3f0841bbc62 /sql/item_subselect.cc | |
parent | ae42e96d28074c7a4c9c959cb7bde08da85feb78 (diff) | |
download | mariadb-git-ed92f9154966401934712d123d9d9c6e71e00e3c.tar.gz |
Bug#47761: crash when killing a query during subquery execution...
The problem was that killing a query during the optimization
phase of a subselect would lead to crashes. The root of the
problem is that the subselect execution engine ignores failures
(eg: killed) during the optimization phase (JOIN::optimize),
leading to a crash once the subquery is executed due to
partially initialized structures (in this case a join tab).
The optimal solution would be to cleanup certain optimizer
structures if the optimization phase fails, but currently
there is no infrastructure to properly to track and cleanup
the structures. To workaround the whole problem one somewhat
good solution is to avoid executing a subselect if the query
has been killed. Cutting short any problems caused by failures
during the optimization phase.
sql/item_subselect.cc:
Do not execute a subselect if the session or query has been killed.
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 26d3833f72c..f89ca2d7955 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -249,9 +249,13 @@ bool Item_subselect::exec() { int res; - if (thd->is_error()) - /* Do not execute subselect in case of a fatal error */ + /* + Do not execute subselect in case of a fatal error + or if the query has been killed. + */ + if (thd->is_error() || thd->killed) return 1; + /* Simulate a failure in sub-query execution. Used to test e.g. out of memory or query being killed conditions. |