List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:July 29 2009 12:45am
Subject:Re: bzr commit into mysql-5.1-bugteam branch
(kristofer.pettersson:3045) Bug#44521
View as plain text  
Hi Kristofer,

On 7/28/09 8:38 PM, Kristofer Pettersson wrote:
> #At file:///Users/thek/Development/mysql-5.1-bugteam/ based on
> revid:davi.arnaut@stripped
>
>   3045 Kristofer Pettersson	2009-07-29
>        Bug#44521 Executing a stored procedure as a prepared statement can sometimes
> cause
>                  an assertion in a debug build.
>
>        The reason is that the C API doesn't support multiple result sets for
> prepared
>        statements and attempting to execute a stored routine which returns multiple
> result
>        sets sometimes lead to a network error. The network error sets the diagnostic
> area
>        prematurely which later leads to the assert when an attempt is made to set a
> second
>        server state.
>
>        This patch fixes the issue by changing the scope of the error code returned
> by
>        sp_instr_stmt::execute() to include any error which happened during the
> execution.
>        To assure that Diagnostic_area::is_sent really mean that the message was sent
> all
>        network related functions are checked for return status.

[..]

> === modified file 'mysql-test/t/sp.test'
> --- a/mysql-test/t/sp.test	2009-06-04 11:53:15 +0000
> +++ b/mysql-test/t/sp.test	2009-07-28 23:38:24 +0000
> @@ -8242,6 +8242,38 @@ while ($tab_count)
>   DROP PROCEDURE p1;
>   DROP TABLE t1;
>
> +--echo #
> +--echo # Bug#44521 Prepared Statement: CALL p() - crashes: `!
> thd->main_da.is_sent' failed et.al.
> +--echo #
> +SELECT GET_LOCK('Bug44521', 0);
> +--connect (con1,localhost,root,,)
> +--echo ** Connection con1
> +delimiter $;
> +CREATE PROCEDURE p()
> +BEGIN
> +  SELECT 1;
> +  SELECT GET_LOCK('Bug44521', 100);
> +  SELECT 2;
> +END$
> +delimiter ;$
> +--send CALL p();
> +--connection default
> +--echo ** Default connection
> +let $wait_condition=
> +  SELECT count(*) = 1 FROM information_schema.processlist
> +  WHERE state = "User lock" AND info = "SELECT GET_LOCK('Bug44521', 100)";
> +--source include/wait_condition.inc
> +let $conid =
> +  `SELECT id FROM information_schema.processlist
> +   WHERE state = "User lock" AND info = "SELECT GET_LOCK('Bug44521', 100)"`;
> +dirty_close con1;
> +SELECT RELEASE_LOCK('Bug44521');
> +let $wait_condition=
> +  SELECT count(*) = 0 FROM information_schema.processlist
> +  WHERE id = $conid;
> +--source include/wait_condition.inc
> +DROP PROCEDURE p;

Please move test case to sp_notembedded.test, asynchronous close is not 
supported under the embedded server. We would be destroying internal 
structures while the thread is still within the server.

>   --echo # ------------------------------------------------------------------
>   --echo # -- End of 5.1 tests
>   --echo # ------------------------------------------------------------------
>
> === modified file 'sql/protocol.cc'
> --- a/sql/protocol.cc	2009-03-24 13:58:52 +0000
> +++ b/sql/protocol.cc	2009-07-28 23:38:24 +0000
> @@ -29,11 +29,11 @@
>
>   static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
>   /* Declared non-static only because of the embedded library. */
> -void net_send_error_packet(THD *thd, uint sql_errno, const char *err);
> -void net_send_ok(THD *, uint, uint, ha_rows, ulonglong, const char *);
> -void net_send_eof(THD *thd, uint server_status, uint total_warn_count);
> +bool net_send_error_packet(THD *thd, uint sql_errno, const char *err);
> +bool net_send_ok(THD *, uint, uint, ha_rows, ulonglong, const char *);
> +bool net_send_eof(THD *thd, uint server_status, uint total_warn_count);
>   #ifndef EMBEDDED_LIBRARY
> -static void write_eof_packet(THD *thd, NET *net,
> +static bool write_eof_packet(THD *thd, NET *net,
>                                uint server_status, uint total_warn_count);

Those functions are also defined in the embedded library. Please grep 
for each function and alter their declarations to match.

[..]

Otherwise looks good.

Regards,

-- Davi Arnaut
Thread
bzr commit into mysql-5.1-bugteam branch (kristofer.pettersson:3045)Bug#44521Kristofer Pettersson29 Jul
  • Re: bzr commit into mysql-5.1-bugteam branch(kristofer.pettersson:3045) Bug#44521Davi Arnaut29 Jul