summaryrefslogtreecommitdiff
path: root/sql/events.cc
diff options
context:
space:
mode:
authorHe Zhenxing <zhenxing.he@sun.com>2009-04-09 14:22:06 +0800
committerHe Zhenxing <zhenxing.he@sun.com>2009-04-09 14:22:06 +0800
commit41361d89467cc59fa1fee8f3eb66c356b4826fe8 (patch)
treeeb323e6b2526e2138c8361715bb993a4c9de55f1 /sql/events.cc
parent72252108f7f8506e48dc74b846be20401bd1cdbb (diff)
downloadmariadb-git-41361d89467cc59fa1fee8f3eb66c356b4826fe8.tar.gz
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
Diffstat (limited to 'sql/events.cc')
-rw-r--r--sql/events.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/events.cc b/sql/events.cc
index 4203ca06d7f..ea935e67bd3 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -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);