Commit 7c472868 authored by unknown's avatar unknown

Make a stab at events_bugs.test failure under valgrind (no

open bug report, reproduced in the runtime team tree).


sql/event_data_objects.cc:
  Make a stub at fixing a race in event_bugs.test under valgrind:
  read of uninitialized byte in SHOW PROCESSLIST from an event thread.
parent c51b8905
...@@ -1913,6 +1913,11 @@ Event_job_data::execute(THD *thd, bool drop) ...@@ -1913,6 +1913,11 @@ Event_job_data::execute(THD *thd, bool drop)
thd->variables.sql_mode= sql_mode; thd->variables.sql_mode= sql_mode;
thd->variables.time_zone= time_zone; thd->variables.time_zone= time_zone;
/*
Peculiar initialization order is a clutch to avoid races in SHOW
PROCESSLIST which reads thd->{query/query_length} without a mutex.
*/
thd->query_length= 0;
thd->query= sp_sql.c_ptr_safe(); thd->query= sp_sql.c_ptr_safe();
thd->query_length= sp_sql.length(); thd->query_length= sp_sql.length();
...@@ -1968,6 +1973,11 @@ end: ...@@ -1968,6 +1973,11 @@ end:
ret= 1; ret= 1;
else else
{ {
/*
Peculiar initialization order is a clutch to avoid races in SHOW
PROCESSLIST which reads thd->{query/query_length} without a mutex.
*/
thd->query_length= 0;
thd->query= sp_sql.c_ptr_safe(); thd->query= sp_sql.c_ptr_safe();
thd->query_length= sp_sql.length(); thd->query_length= sp_sql.length();
if (Events::drop_event(thd, dbname, name, FALSE)) if (Events::drop_event(thd, dbname, name, FALSE))
......
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