1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-16 11:21:15 +03:00

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.
This commit is contained in:
Jon Olav Hauglid
2010-07-05 13:59:34 +02:00
parent 635ccedbbc
commit ecfd9958a1
4 changed files with 76 additions and 0 deletions

View File

@ -1757,3 +1757,35 @@ disconnect con51355;
--echo # Connection default --echo # Connection default
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;

View File

@ -1710,3 +1710,23 @@ ERROR 42S02: Table 'test.t1' doesn't exist
HANDLER t1 CLOSE; HANDLER t1 CLOSE;
# Connection con51355 # Connection con51355
# Connection default # 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;

View File

@ -1707,6 +1707,26 @@ HANDLER t1 CLOSE;
# Connection con51355 # Connection con51355
# Connection default # 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 # BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
# #
CREATE TABLE t1 AS SELECT 1 AS f1; CREATE TABLE t1 AS SELECT 1 AS f1;

View File

@ -747,7 +747,11 @@ retry:
goto ok; goto ok;
} }
if (cond && !cond->val_int()) if (cond && !cond->val_int())
{
if (thd->is_error())
goto err;
continue; continue;
}
if (num_rows >= offset_limit_cnt) if (num_rows >= offset_limit_cnt)
{ {
protocol->prepare_for_resend(); protocol->prepare_for_resend();