Commit eb90f297 authored by unknown's avatar unknown

Merge mysql.com:/home/hf/work/33334/my50-33334

into  mysql.com:/home/hf/work/33334/my51-33334


client/mysqltest.c:
  Auto merged
mysql-test/r/flush.result:
  SCCS merged
mysql-test/t/flush.test:
  SCCS merged
parents 9bd3b854 4018b139
......@@ -529,6 +529,17 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len,
return 0;
}
static void wait_query_thread_end(struct st_connection *con)
{
if (!con->query_done)
{
pthread_mutex_lock(&con->mutex);
while (!con->query_done)
pthread_cond_wait(&con->cond, &con->mutex);
pthread_mutex_unlock(&con->mutex);
}
}
#else /*EMBEDDED_LIBRARY*/
#define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len)
......@@ -4001,7 +4012,14 @@ void do_close_connection(struct st_command *command)
con->mysql.net.vio = 0;
}
}
#endif
#else
/*
As query could be still executed in a separate theread
we need to check if the query's thread was finished and probably wait
(embedded-server specific)
*/
wait_query_thread_end(con);
#endif /*EMBEDDED_LIBRARY*/
if (con->stmt)
mysql_stmt_close(con->stmt);
con->stmt= 0;
......@@ -4287,6 +4305,9 @@ void do_connect(struct st_command *command)
(int) (sizeof(connections)/sizeof(struct st_connection)));
}
#ifdef EMBEDDED_LIBRARY
con_slot->query_done= 1;
#endif
if (!mysql_init(&con_slot->mysql))
die("Failed on mysql_init()");
if (opt_compress || con_compress)
......@@ -5789,12 +5810,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
query's thread was finished and probably wait
*/
else if (flags & QUERY_REAP_FLAG)
{
pthread_mutex_lock(&cn->mutex);
while (!cn->query_done)
pthread_cond_wait(&cn->cond, &cn->mutex);
pthread_mutex_unlock(&cn->mutex);
}
wait_query_thread_end(cn);
#endif /*EMBEDDED_LIBRARY*/
if (!(flags & QUERY_REAP_FLAG))
DBUG_VOID_RETURN;
......
......@@ -72,6 +72,7 @@ flush tables with read lock;
unlock tables;
drop table t1, t2;
set session low_priority_updates=default;
select benchmark(200, (select sin(1))) > 1000;
End of 5.0 tests
set @old_general_log= @@general_log;
set @old_read_only= @@read_only;
......
......@@ -164,6 +164,15 @@ drop table t1, t2;
set session low_priority_updates=default;
#
# Bug #33334 mysqltest_embedded crashes when disconnecting before reap
#
connect (con1,localhost,root,,);
send select benchmark(200, (select sin(1))) > 1000;
disconnect con1;
connection default;
--echo End of 5.0 tests
#
......
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