Commit f472e0fd authored by unknown's avatar unknown

Fix for spurious failures of sp.test on many platforms (aka Bug #9161

"Warnings on 'drop procedure' platform-specific").

In mysqltest we should not issue "SHOW WARNINGS" until we have not 
read results from all statements in multi-statement.

Otherwise such "SHOW WARNINGS" will either cause "Packets out of order"
error and thus will ruin current connection (but we may not notice this as
it happened in sp.test because we ignore errors from such auxilary
SHOW WARNINGS and use auto-reconnecting connections) or will
succeed but consume first packet from next statement in multi-statement
sequence (this happens if "SHOW WARNINGS" is issued when this packet
is already received by client. Packet is thrown away by net_clear()
call which is issued when "SHOW WARNINGS" is sent to server).

In our case sp.test failed because usually we had first situation
but sometimes second situation occured causing warning to pop-up.


client/mysqltest.c:
  We should not issue "SHOW WARNINGS" if we have not processed all 
  results from multi-statement.
parent e33182eb
......@@ -2746,8 +2746,13 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)
append_result(ds, res);
}
/* Add all warnings to the result */
if (!disable_warnings && mysql_warning_count(mysql))
/*
Add all warnings to the result. We can't do this if we are in
the middle of processing results from multi-statement, because
this will break protocol.
*/
if (!disable_warnings && !mysql_more_results(mysql) &&
mysql_warning_count(mysql))
{
MYSQL_RES *warn_res=0;
uint count= mysql_warning_count(mysql);
......@@ -3363,6 +3368,13 @@ static void run_query_stmt_handle_warnings(MYSQL *mysql, DYNAMIC_STRING *ds)
if (!disable_warnings && (count= mysql_warning_count(mysql)))
{
/*
If one day we will support execution of multi-statements
through PS API we should not issue SHOW WARNINGS until
we have not read all results...
*/
DBUG_ASSERT(!mysql_more_results(mysql));
if (mysql_real_query(mysql, "SHOW WARNINGS", 13) == 0)
{
MYSQL_RES *warn_res= mysql_store_result(mysql);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment