Commit 7e532b13 authored by Konstantin Osipov's avatar Konstantin Osipov

Backport of:

------------------------------------------------------------
revno: 2642
committer: davi@mysql.com/endora.local
timestamp: Fri 2008-05-16 01:29:09 -0300
message:
Fix for a valgrind warning due to a jump on a uninitialized
variable. The problem was that the sql profile preparation
function wasn't being called for all possible code paths
of query execution. The solution is to move the preparation
to the dispatch_command function and to explicitly call the
profile preparation function on bootstrap.
parent 7fc7fb0e
......@@ -812,11 +812,7 @@ bool do_command(THD *thd)
net_new_transaction(net);
packet_length= my_net_read(net);
#if defined(ENABLED_PROFILING)
thd->profiling.start_new_query();
#endif
if (packet_length == packet_error)
if ((packet_length= my_net_read(net)) == packet_error)
{
DBUG_PRINT("info",("Got error %d reading command from socket %s",
net->error,
......@@ -873,9 +869,6 @@ bool do_command(THD *thd)
return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1));
out:
#if defined(ENABLED_PROFILING)
thd->profiling.finish_current_query();
#endif
DBUG_RETURN(return_value);
}
#endif /* EMBEDDED_LIBRARY */
......@@ -977,6 +970,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_ENTER("dispatch_command");
DBUG_PRINT("info",("packet: '%*.s'; command: %d", packet_length, packet, command));
#if defined(ENABLED_PROFILING)
thd->profiling.start_new_query();
#endif
MYSQL_COMMAND_START(thd->thread_id, command,
thd->security_ctx->priv_user,
(char *) thd->security_ctx->host_or_ip);
......@@ -1608,6 +1604,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
#if defined(ENABLED_PROFILING)
thd->profiling.finish_current_query();
#endif
if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
{
int res;
......
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