List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:August 15 2008 3:38pm
Subject:bzr commit into mysql-5.1-bugteam branch (davi:2702) Bug#38560
View as plain text  
# At a local mysql-5.1-bugteam repository of davi

 2702 Davi Arnaut	2008-08-15
      Bug#38560: valgrind warnings on PB due to query profiling
      
      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 ensure that query profiling is always
      started before dispatch_command function is called and to
      explicitly call the profile preparation function on bootstrap.
modified:
  sql/sql_parse.cc

per-file messages:
  sql/sql_parse.cc
    Finish query profiling properly when executing bootstrap commands.
    Add query profiling to execute_init_command as it calls dispatch_command.
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2008-08-07 02:23:58 +0000
+++ b/sql/sql_parse.cc	2008-08-15 15:38:46 +0000
@@ -329,6 +329,12 @@ void execute_init_command(THD *thd, sys_
   Vio* save_vio;
   ulong save_client_capabilities;
 
+#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
+  thd->profiling.start_new_query();
+  thd->profiling.set_query_source(init_command_var->value,
+                                  init_command_var->value_length);
+#endif
+
   thd_proc_info(thd, "Execution of init_command");
   /*
     We need to lock init_command_var because
@@ -350,6 +356,10 @@ void execute_init_command(THD *thd, sys_
   rw_unlock(var_mutex);
   thd->client_capabilities= save_client_capabilities;
   thd->net.vio= save_vio;
+
+#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
+  thd->profiling.finish_current_query();
+#endif
 }
 
 
@@ -441,6 +451,7 @@ pthread_handler_t handle_bootstrap(void 
     thd->query[length] = '\0';
     DBUG_PRINT("query",("%-.4096s",thd->query));
 #if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
+    thd->profiling.start_new_query();
     thd->profiling.set_query_source(thd->query, length);
 #endif
 
@@ -456,6 +467,10 @@ pthread_handler_t handle_bootstrap(void 
     bootstrap_error= thd->is_error();
     net_end_statement(thd);
 
+#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
+    thd->profiling.finish_current_query();
+#endif
+
     if (bootstrap_error)
       break;
 

Thread
bzr commit into mysql-5.1-bugteam branch (davi:2702) Bug#38560Davi Arnaut15 Aug