1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

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.
This commit is contained in:
Konstantin Osipov
2009-11-23 14:01:20 +03:00
parent 6156cfee67
commit f238113dec

View File

@@ -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;