Commit 67ca21d8 authored by Bjorn Munch's avatar Bjorn Munch

Bug #49269 mysqltest crashes on 'reap' if query executed after 'send'

Set a flag after send to trap the case
parent 981d6473
...@@ -228,6 +228,8 @@ struct st_connection ...@@ -228,6 +228,8 @@ struct st_connection
char *name; char *name;
size_t name_len; size_t name_len;
MYSQL_STMT* stmt; MYSQL_STMT* stmt;
/* Set after send to disallow other queries before reap */
my_bool pending;
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
const char *cur_query; const char *cur_query;
...@@ -4691,6 +4693,7 @@ void do_close_connection(struct st_command *command) ...@@ -4691,6 +4693,7 @@ void do_close_connection(struct st_command *command)
if (con->util_mysql) if (con->util_mysql)
mysql_close(con->util_mysql); mysql_close(con->util_mysql);
con->util_mysql= 0; con->util_mysql= 0;
con->pending= FALSE;
my_free(con->name, MYF(0)); my_free(con->name, MYF(0));
...@@ -6513,6 +6516,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, ...@@ -6513,6 +6516,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
if (flags & QUERY_SEND_FLAG) if (flags & QUERY_SEND_FLAG)
{ {
if (cn->pending)
die ("Cannot run query on connection between send and reap");
/* /*
Send the query Send the query
*/ */
...@@ -6532,7 +6538,10 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, ...@@ -6532,7 +6538,10 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
wait_query_thread_end(cn); wait_query_thread_end(cn);
#endif /*EMBEDDED_LIBRARY*/ #endif /*EMBEDDED_LIBRARY*/
if (!(flags & QUERY_REAP_FLAG)) if (!(flags & QUERY_REAP_FLAG))
{
cn->pending= TRUE;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
}
do do
{ {
...@@ -6622,6 +6631,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, ...@@ -6622,6 +6631,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
end: end:
cn->pending= FALSE;
/* /*
We save the return code (mysql_errno(mysql)) from the last call sent We save the return code (mysql_errno(mysql)) from the last call sent
to the server into the mysqltest builtin variable $mysql_errno. This to the server into the mysqltest builtin variable $mysql_errno. This
......
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