Commit 077f0812 authored by marko@hundin.mysql.fi's avatar marko@hundin.mysql.fi

ha_innodb.cc:

  innobase_mysql_print_thd(): protect thd with LOCK_thread_count (Bug #3596)
parent bd8901fd
...@@ -328,6 +328,8 @@ innobase_mysql_print_thd( ...@@ -328,6 +328,8 @@ innobase_mysql_print_thd(
thd = (const THD*) input_thd; thd = (const THD*) input_thd;
VOID(pthread_mutex_lock(&LOCK_thread_count));
fprintf(f, "MySQL thread id %lu, query id %lu", fprintf(f, "MySQL thread id %lu, query id %lu",
thd->thread_id, thd->query_id); thd->thread_id, thd->query_id);
if (thd->host) { if (thd->host) {
...@@ -351,11 +353,16 @@ innobase_mysql_print_thd( ...@@ -351,11 +353,16 @@ innobase_mysql_print_thd(
} }
if ((s = thd->query)) { if ((s = thd->query)) {
putc(' ', f); /* determine the length of the query string */
fputs(s, f); uint32 i, len = thd->query_length;
for (i = 0; i < len && s[i]; i++);
putc('\n', f);
fwrite(s, 1, i, f);
} }
putc('\n', f); putc('\n', f);
VOID(pthread_mutex_unlock(&LOCK_thread_count));
} }
/************************************************************************* /*************************************************************************
......
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