Commit 9d32b8b2 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-5138 Numerous test failures in "mtr --ps --embedded".

     Thread can be disconnected internally for example after COMMIT statements.
     So we should check this for the statement execution.
parent 8a6a95a1
......@@ -40,6 +40,7 @@ C_MODE_START
extern unsigned int mysql_server_last_errno;
extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
static my_bool emb_read_query_result(MYSQL *mysql);
static void emb_free_embedded_thd(MYSQL *mysql);
extern "C" void unireg_clear(int exit_code)
......@@ -107,6 +108,17 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
NET *net= &mysql->net;
my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE;
if (thd->killed != NOT_KILLED)
{
if (thd->killed < KILL_CONNECTION)
thd->killed= NOT_KILLED;
else
{
emb_free_embedded_thd(mysql);
thd= 0;
}
}
if (!thd)
{
/* Do "reconnect" if possible */
......
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