Commit f18ec676 authored by unknown's avatar unknown
Browse files

WL#3337 (Event scheduler new architecture)

Don't send affected rows after CREATE/ALTER/DROP EVENT as this is
inconsistent with the rest of the server in terms of CREATE/ALTER/DROP
DDLs


sql/event_data_objects.cc:
  Events::drop_event() does not expect anymore a parameter named affected_rows
sql/event_db_repository.cc:
  Remove rows_affected as the behavior exposed by Events is not
  coherent with the behavior of many other DDL, like CREATE PROCEDURE, etc.
sql/event_db_repository.h:
  Remove rows_affected as the behavior exposed by Events is not
  coherent with the behavior of many other DDL, like CREATE PROCEDURE, etc.
sql/events.cc:
  Remove rows_affected as the behavior exposed by Events is not
  coherent with the behavior of many other DDL, like CREATE PROCEDURE, etc.
sql/events.h:
  Remove rows_affected as the behavior exposed by Events is not
  coherent with the behavior of many other DDL, like CREATE PROCEDURE, etc.
sql/sql_parse.cc:
  Don't send affected rows, because this behavior is not consistent
  with the rest of the server for CREATE/ALTER/DROP DDLs
parent bd868fb6
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1437,11 +1437,10 @@ Event_queue_element::mark_last_executed(THD *thd)
int
Event_queue_element::drop(THD *thd)
{
  uint tmp= 0;
  DBUG_ENTER("Event_queue_element::drop");

  DBUG_RETURN(Events::get_instance()->
                    drop_event(thd, dbname, name, FALSE, &tmp, TRUE));
                    drop_event(thd, dbname, name, FALSE, TRUE));
}


+2 −6
Original line number Diff line number Diff line
@@ -508,7 +508,6 @@ check_parse_params(THD *thd, Event_parse_data *parse_data)
      thd             [in]  THD
      parse_data      [in]  Object containing info about the event
      create_if_not   [in]  Whether to generate anwarning in case event exists
      rows_affected   [out] How many rows were affected

  RETURN VALUE
    0                   OK
@@ -521,7 +520,7 @@ check_parse_params(THD *thd, Event_parse_data *parse_data)

bool
Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
                                  my_bool create_if_not, uint *rows_affected)
                                  my_bool create_if_not)
{
  int ret= 0;
  CHARSET_INFO *scs= system_charset_info;
@@ -532,7 +531,6 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,

  DBUG_ENTER("Event_db_repository::create_event");

  *rows_affected= 0;
  if (check_parse_params(thd, parse_data))
    goto err;

@@ -621,7 +619,6 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
    goto err;
  }

  *rows_affected= 1;
ok:
  if (dbchanged)
    (void) mysql_change_db(thd, old_db.str, 1);
@@ -760,7 +757,6 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
      name            [in]  Event's name
      drop_if_exists  [in]  If set and the event not existing => warning
                            onto the stack
      rows_affected   [out] Affected number of rows is returned heres

  RETURN VALUE
    FALSE  OK
@@ -769,7 +765,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,

bool
Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name,
                                bool drop_if_exists, uint *rows_affected)
                                bool drop_if_exists)
{
  TABLE *table= NULL;
  Open_tables_state backup;
+2 −4
Original line number Diff line number Diff line
@@ -56,16 +56,14 @@ class Event_db_repository
  Event_db_repository(){}

  bool
  create_event(THD *thd, Event_parse_data *parse_data, my_bool create_if_not,
               uint *rows_affected);
  create_event(THD *thd, Event_parse_data *parse_data, my_bool create_if_not);

  bool
  update_event(THD *thd, Event_parse_data *parse_data, LEX_STRING *new_dbname,
               LEX_STRING *new_name);

  bool 
  drop_event(THD *thd, LEX_STRING db, LEX_STRING name, bool drop_if_exists,
             uint *rows_affected);
  drop_event(THD *thd, LEX_STRING db, LEX_STRING name, bool drop_if_exists);

  void
  drop_schema_events(THD *thd, LEX_STRING schema);
+5 −12
Original line number Diff line number Diff line
@@ -304,7 +304,6 @@ Events::open_event_table(THD *thd, enum thr_lock_type lock_type,
      thd            [in]  THD
      parse_data     [in]  Event's data from parsing stage
      if_not_exists  [in]  Whether IF NOT EXISTS was specified in the DDL
      rows_affected  [out] How many rows were affected

  RETURN VALUE
    FALSE  OK
@@ -316,8 +315,7 @@ Events::open_event_table(THD *thd, enum thr_lock_type lock_type,
*/

bool
Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists,
                     uint *rows_affected)
Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists)
{
  int ret;
  DBUG_ENTER("Events::create_event");
@@ -329,8 +327,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists,

  pthread_mutex_lock(&LOCK_event_metadata);
  /* On error conditions my_error() is called so no need to handle here */
  if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists,
                                         rows_affected)))
  if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists)))
  {
    if ((ret= event_queue->create_event(thd, parse_data->dbname,
                                        parse_data->name)))
@@ -353,7 +350,6 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists,
      thd           [in]  THD
      parse_data    [in]  Event's data from parsing stage
      rename_to     [in]  Set in case of RENAME TO.
      rows_affected [out] How many rows were affected.

  RETURN VALUE
    FALSE  OK
@@ -366,8 +362,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists,
*/

bool
Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to,
                     uint *rows_affected)
Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to)
{
  int ret;
  DBUG_ENTER("Events::update_event");
@@ -406,7 +401,6 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to,
      name            [in]  Event's name
      if_exists       [in]  When set and the event does not exist =>
                            warning onto the stack
      rows_affected   [out] Affected number of rows is returned here
      only_from_disk  [in]  Whether to remove the event from the queue too.
                            In case of Event_job_data::drop() it's needed to
                            do only disk drop because Event_queue will handle
@@ -419,7 +413,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to,

bool
Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists,
                   uint *rows_affected, bool only_from_disk)
                   bool only_from_disk)
{
  int ret;
  DBUG_ENTER("Events::drop_event");
@@ -431,8 +425,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists,

  pthread_mutex_lock(&LOCK_event_metadata);
  /* On error conditions my_error() is called so no need to handle here */
  if (!(ret= db_repository->drop_event(thd, dbname, name, if_exists,
                                       rows_affected)))
  if (!(ret= db_repository->drop_event(thd, dbname, name, if_exists)))
  {
    if (!only_from_disk)
      event_queue->drop_event(thd, dbname, name);
+3 −5
Original line number Diff line number Diff line
@@ -77,16 +77,14 @@ class Events
  get_instance();

  bool
  create_event(THD *thd, Event_parse_data *parse_data, bool if_exists,
               uint *rows_affected);
  create_event(THD *thd, Event_parse_data *parse_data, bool if_exists);

  bool
  update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to,
               uint *rows_affected);
  update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to);

  bool
  drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists,
             uint *rows_affected, bool only_from_disk);
             bool only_from_disk);

  void
  drop_schema_events(THD *thd, char *db);
Loading