diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2009-09-08 00:50:10 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2009-09-08 00:50:10 +0400 |
commit | 29f0dcb56337a3e352ad7a70dcff6b25bb605325 (patch) | |
tree | 84935c21dc958724ae7dcbeeca0c0f08986fc430 /sql/events.cc | |
parent | 915a624cbcb58a10a2cfb2e2e4fd5029191fa86a (diff) | |
parent | 8a2454f8e9fce648272577fcf8006ae6e6806cf9 (diff) | |
download | mariadb-git-29f0dcb56337a3e352ad7a70dcff6b25bb605325.tar.gz |
Merge MySQL->MariaDB
* Finished Monty and Jani's merge
* Some InnoDB tests still fail (because it's old xtradb code run against
newer testsuite). They are expected to go after mergning with the latest
xtradb.
Diffstat (limited to 'sql/events.cc')
-rw-r--r-- | sql/events.cc | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/sql/events.cc b/sql/events.cc index e1b4dd4d513..17b00490495 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -411,6 +411,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 @@ -418,8 +419,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 @@ -428,6 +430,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); @@ -843,22 +851,23 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */) } -/* - Inits the scheduler's structures. +/** + Initializes the scheduler's structures. - SYNOPSIS - Events::init() + @param opt_noacl_or_bootstrap + TRUE if there is --skip-grant-tables or --bootstrap + option. In that case we disable the event scheduler. - NOTES - This function is not synchronized. + @note This function is not synchronized. - RETURN VALUE - FALSE OK - TRUE Error in case the scheduler can't start + @retval FALSE Perhaps there was an error, and the event scheduler + is disabled. But the error is not fatal and the + server start up can continue. + @retval TRUE Fatal error. Startup must terminate (call unireg_abort()). */ bool -Events::init(my_bool opt_noacl) +Events::init(my_bool opt_noacl_or_bootstrap) { THD *thd; @@ -866,11 +875,6 @@ Events::init(my_bool opt_noacl) DBUG_ENTER("Events::init"); - /* Disable the scheduler if running with --skip-grant-tables */ - if (opt_noacl) - opt_event_scheduler= EVENTS_DISABLED; - - /* We need a temporary THD during boot */ if (!(thd= new THD())) { @@ -899,23 +903,30 @@ Events::init(my_bool opt_noacl) /* Since we allow event DDL even if the scheduler is disabled, check the system tables, as we might need them. + + If run with --skip-grant-tables or --bootstrap, don't try to do the + check of system tables and don't complain: in these modes the tables + are most likely not there and we're going to disable the event + scheduler anyway. */ - if (Event_db_repository::check_system_tables(thd)) + if (opt_noacl_or_bootstrap || Event_db_repository::check_system_tables(thd)) { - sql_print_error("Event Scheduler: An error occurred when initializing " - "system tables.%s", - opt_event_scheduler == EVENTS_DISABLED ? - "" : " Disabling the Event Scheduler."); + if (! opt_noacl_or_bootstrap) + { + sql_print_error("Event Scheduler: An error occurred when initializing " + "system tables. Disabling the Event Scheduler."); + check_system_tables_error= TRUE; + } /* Disable the scheduler since the system tables are not up to date */ opt_event_scheduler= EVENTS_DISABLED; - check_system_tables_error= TRUE; goto end; } /* Was disabled explicitly from the command line, or because we're running - with --skip-grant-tables, or because we have no system tables. + with --skip-grant-tables, or --bootstrap, or because we have no system + tables. */ if (opt_event_scheduler == Events::EVENTS_DISABLED) goto end; |