From: Jon Olav Hauglid Date: October 27 2011 9:27am Subject: bzr push into mysql-trunk branch (jon.hauglid:3536 to 3537) Bug#13113222 List-Archive: http://lists.mysql.com/commits/141602 X-Bug: 13113222 Message-Id: <201110270927.p9R9R6Oh029201@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3537 Jon Olav Hauglid 2011-10-27 Bug#13113222 RQG_SIGNAL_RESIGNAL FAILED WITH ASSERTION. The triggered assert checks that a matching condition is found inside the diagnostics area when a handler is activated. It was triggered in this case if the diagnostics area was full when the condition was reported (e.g. the area already contains max_error_count conditions). This meant that the diagnostics area did not contain a matching condition when the handler code tried to look for it. This was a regression introduced by WL#5986. This patch fixes the problem by temporarily making a condition in such cases so it can be handled properly. Test case added to sp-error.test. modified: mysql-test/r/sp-error.result mysql-test/t/sp-error.test sql/sp_rcontext.cc 3536 Jimmy Yang 2011-10-27 Fix Bug #12622592 - UT_AD ASSERT IGNORE_ERR!=DICT_ERR_IGNORE_NONE|| TABLE->CORRUPTET==0 rb://791 approved by Sunny Bains modified: storage/innobase/dict/dict0dict.c === modified file 'mysql-test/r/sp-error.result' --- a/mysql-test/r/sp-error.result 2011-10-14 15:04:41 +0000 +++ b/mysql-test/r/sp-error.result 2011-10-27 09:26:31 +0000 @@ -2820,3 +2820,29 @@ H2 DROP PROCEDURE p1; DROP PROCEDURE p2; +# +# Bug#13113222 RQG_SIGNAL_RESIGNAL FAILED WITH ASSERTION. +# +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +CREATE PROCEDURE p1() +BEGIN +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'triggered p1'; +# This will trigger an error. +SIGNAL SQLSTATE 'HY000'; +END| +CREATE PROCEDURE p2() +BEGIN +DECLARE CONTINUE HANDLER FOR SQLWARNING SELECT 'triggered p2'; +# This will trigger a warning. +SIGNAL SQLSTATE '01000'; +END| +SET @old_max_error_count= @@session.max_error_count; +SET SESSION max_error_count= 0; +CALL p1(); +triggered p1 +triggered p1 +CALL p2(); +SET SESSION max_error_count= @old_max_error_count; +DROP PROCEDURE p1; +DROP PROCEDURE p2; === modified file 'mysql-test/t/sp-error.test' --- a/mysql-test/t/sp-error.test 2011-10-14 15:04:41 +0000 +++ b/mysql-test/t/sp-error.test 2011-10-27 09:26:31 +0000 @@ -3776,3 +3776,38 @@ delimiter ;| --echo DROP PROCEDURE p1; DROP PROCEDURE p2; + + +--echo # +--echo # Bug#13113222 RQG_SIGNAL_RESIGNAL FAILED WITH ASSERTION. +--echo # + +--disable_warnings +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +--enable_warnings + +delimiter |; +CREATE PROCEDURE p1() +BEGIN + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'triggered p1'; + # This will trigger an error. + SIGNAL SQLSTATE 'HY000'; +END| + +CREATE PROCEDURE p2() +BEGIN + DECLARE CONTINUE HANDLER FOR SQLWARNING SELECT 'triggered p2'; + # This will trigger a warning. + SIGNAL SQLSTATE '01000'; +END| +delimiter ;| + +SET @old_max_error_count= @@session.max_error_count; +SET SESSION max_error_count= 0; +CALL p1(); +CALL p2(); +SET SESSION max_error_count= @old_max_error_count; + +DROP PROCEDURE p1; +DROP PROCEDURE p2; === modified file 'sql/sp_rcontext.cc' --- a/sql/sp_rcontext.cc 2011-10-11 15:01:02 +0000 +++ b/sql/sp_rcontext.cc 2011-10-27 09:26:31 +0000 @@ -230,6 +230,23 @@ bool sp_rcontext::handle_sql_condition(T if (found_handler) found_condition= da->get_error_condition(); + + /* + Found condition can be NULL if the diagnostics area was full + when the error was raised. It can also be NULL if + Diagnostics_area::set_error_status(uint sql_error) was used. + In these cases, make a temporary Sql_condition here so the + error can be handled. + */ + if (!found_condition) + { + Sql_condition *condition= + new (callers_arena->mem_root) Sql_condition(callers_arena->mem_root); + condition->set(da->sql_errno(), da->get_sqlstate(), + Sql_condition::WARN_LEVEL_ERROR, + da->message()); + found_condition= condition; + } } else if (da->current_statement_warn_count()) { No bundle (reason: useless for push emails).