Post fix of BUG#37145

Binlog the CREATE EVENT unless the created event been successfully dropped

Modified Query_log_event constructor to make sure that error_code
is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
when NOT_KILLED

sql/events.cc:
  binlog the create event unless it's been successfully dropped
sql/log_event.cc:
  Modified Query_log_event constructor to make sure that error_code
  is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
  when NOT_KILLED
This commit is contained in:
He Zhenxing 2009-04-09 14:22:06 +08:00
commit caaa8531bd
2 changed files with 20 additions and 3 deletions

View file

@ -412,6 +412,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists)))
{
Event_queue_element *new_element;
bool dropped= 0;
if (!(new_element= new Event_queue_element()))
ret= TRUE; // OOM
@ -419,8 +420,9 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
parse_data->name,
new_element)))
{
db_repository->drop_event(thd, parse_data->dbname, parse_data->name,
TRUE);
if (!db_repository->drop_event(thd, parse_data->dbname, parse_data->name,
TRUE))
dropped= 1;
delete new_element;
}
else
@ -429,6 +431,12 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
bool created;
if (event_queue)
event_queue->create_event(thd, new_element, &created);
}
/*
binlog the create event unless it's been successfully dropped
*/
if (!dropped)
{
/* Binlog the create event. */
DBUG_ASSERT(thd->query && thd->query_length);
write_bin_log(thd, TRUE, thd->query, thd->query_length);