summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2014-04-15 18:16:47 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2014-04-15 18:16:47 +0500
commit9d32b8b2aa717441ce22eac27a38192409331eb1 (patch)
tree28a1857bc36e988f5cf9c693b93ea30514ae304d
parent8a6a95a11191a7798311ce40bc91f68992559ec3 (diff)
downloadmariadb-git-9d32b8b2aa717441ce22eac27a38192409331eb1.tar.gz
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.
-rw-r--r--libmysqld/lib_sql.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 2e5a35cda5e..db6cb2bf561 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -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 */