#At file:///export/home/x/mysql-trunk-runtime-bug54401/ based on revid:kostja@stripped
3076 Jon Olav Hauglid 2010-07-05
Bug #54401 assert in Diagnostics_area::set_eof_status , HANDLER
This assert checks that the server does not try to send EOF to the
client if there has been some error during processing. This to make
sure that the error is in fact sent to the client.
The problem was that any errors during processing of WHERE conditions
in HANDLER ... READ statements where not detected by the handler code.
The handler code therefore still tried to send EOF to the client,
triggering the assert. The bug was only noticeable in debug builds.
This patch fixes the problem by making sure that the handler code
checks for errors during condition processing and acts accordingly.
modified:
mysql-test/include/handler.inc
mysql-test/r/handler_innodb.result
mysql-test/r/handler_myisam.result
sql/sql_handler.cc
=== modified file 'mysql-test/include/handler.inc'
--- a/mysql-test/include/handler.inc 2010-02-25 17:08:12 +0000
+++ b/mysql-test/include/handler.inc 2010-07-05 11:59:34 +0000
@@ -1757,3 +1757,35 @@ disconnect con51355;
--echo # Connection default
connection default;
+
+--echo #
+--echo # Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+delimiter |;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+ SELECT 1 FROM t2 INTO @a;
+ RETURN 1;
+END|
+delimiter ;|
+
+# Get f1() parsed and cached
+--error ER_NO_SUCH_TABLE
+SELECT f1();
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1);
+HANDLER t1 OPEN;
+# This used to cause the assert
+--error ER_NO_SUCH_TABLE
+HANDLER t1 READ FIRST WHERE f1() = 1;
+HANDLER t1 CLOSE;
+
+DROP FUNCTION f1;
+DROP TABLE t1;
=== modified file 'mysql-test/r/handler_innodb.result'
--- a/mysql-test/r/handler_innodb.result 2010-02-25 17:08:12 +0000
+++ b/mysql-test/r/handler_innodb.result 2010-07-05 11:59:34 +0000
@@ -1710,3 +1710,23 @@ ERROR 42S02: Table 'test.t1' doesn't exi
HANDLER t1 CLOSE;
# Connection con51355
# Connection default
+#
+# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
+#
+DROP TABLE IF EXISTS t1, t2;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+SELECT 1 FROM t2 INTO @a;
+RETURN 1;
+END|
+SELECT f1();
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1);
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST WHERE f1() = 1;
+ERROR 42S02: Table 'test.t2' doesn't exist
+HANDLER t1 CLOSE;
+DROP FUNCTION f1;
+DROP TABLE t1;
=== modified file 'mysql-test/r/handler_myisam.result'
--- a/mysql-test/r/handler_myisam.result 2010-06-11 15:36:57 +0000
+++ b/mysql-test/r/handler_myisam.result 2010-07-05 11:59:34 +0000
@@ -1707,6 +1707,26 @@ HANDLER t1 CLOSE;
# Connection con51355
# Connection default
#
+# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
+#
+DROP TABLE IF EXISTS t1, t2;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+SELECT 1 FROM t2 INTO @a;
+RETURN 1;
+END|
+SELECT f1();
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1);
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST WHERE f1() = 1;
+ERROR 42S02: Table 'test.t2' doesn't exist
+HANDLER t1 CLOSE;
+DROP FUNCTION f1;
+DROP TABLE t1;
+#
# BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
#
CREATE TABLE t1 AS SELECT 1 AS f1;
=== modified file 'sql/sql_handler.cc'
--- a/sql/sql_handler.cc 2010-06-17 13:31:51 +0000
+++ b/sql/sql_handler.cc 2010-07-05 11:59:34 +0000
@@ -747,7 +747,11 @@ retry:
goto ok;
}
if (cond && !cond->val_int())
+ {
+ if (thd->is_error())
+ goto err;
continue;
+ }
if (num_rows >= offset_limit_cnt)
{
protocol->prepare_for_resend();
Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20100705115934-1bbofu9atrundyrg.bundle
Thread |
---|
• bzr commit into mysql-trunk-runtime branch (jon.hauglid:3076) Bug#54401 | Jon Olav Hauglid | 5 Jul |