Commit ea09d626 authored by unknown's avatar unknown
Browse files

Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into lmy004.:/work/mysql-5.1-tt-copy-works


sql/event.cc:
  Auto merged
sql/event_executor.cc:
  Auto merged
sql/event_timed.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents 004d728a e2a613bc
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -89,6 +89,21 @@ int my_date_to_str(const MYSQL_TIME *l_time, char *to);
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to);
int my_TIME_to_str(const MYSQL_TIME *l_time, char *to);

/*
  The following must be sorted so that simple intervals comes first.
  (get_interval_value() depends on this)
*/

enum interval_type
{
  INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_DAY, INTERVAL_HOUR,
  INTERVAL_MINUTE, INTERVAL_WEEK, INTERVAL_SECOND, INTERVAL_MICROSECOND ,
  INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE,
  INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND,
  INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND,
  INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND
};

C_MODE_END

#endif /* _my_time_h_ */
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ c_tzn="" c_tz="" c_tzt="" c_tztt="" c_tzls="" c_pl=""
i_tzn="" i_tz="" i_tzt="" i_tztt="" i_tzls="" i_pl=""
c_p="" c_pp=""
c_gl="" c_sl=""
c_ev= ""

# Check for old tables
if test ! -f $mdata/db.frm
+15 −4
Original line number Diff line number Diff line
@@ -88,8 +88,14 @@ int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs)
int
my_time_compare(TIME *a, TIME *b)
{

#ifdef ENABLE_WHEN_WE_HAVE_MILLISECOND_IN_TIMESTAMPS
  my_ulonglong a_t= TIME_to_ulonglong_datetime(a)*100L + a->second_part;
  my_ulonglong b_t= TIME_to_ulonglong_datetime(b)*100L + b->second_part;
#else
  my_ulonglong a_t= TIME_to_ulonglong_datetime(a);
  my_ulonglong b_t= TIME_to_ulonglong_datetime(b);
#endif

  if (a_t > b_t)
    return 1;
@@ -355,12 +361,17 @@ db_create_event(THD *thd, event_timed *et, my_bool create_if_not,

  DBUG_PRINT("info", ("check existance of an event with the same name"));
  if (!evex_db_find_event_aux(thd, et->dbname, et->name, table))
  {
    if (create_if_not)
    {
      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
		          ER_EVENT_ALREADY_EXISTS, ER(ER_EVENT_ALREADY_EXISTS),
		          et->name.str);
      goto ok;    
    }
    my_error(ER_EVENT_ALREADY_EXISTS, MYF(0), et->name.str);
    goto err;
  }

  DBUG_PRINT("info", ("non-existant, go forward"));
  if ((ret= sp_use_new_db(thd, et->dbname.str,olddb, sizeof(olddb),0, &dbchanged)))
+2 −2
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ class event_timed
  compute_next_execution_time();  

  void
  mark_last_executed();
  mark_last_executed(THD *thd);
  
  int
  drop(THD *thd);
+19 −4
Original line number Diff line number Diff line
@@ -334,9 +334,19 @@ event_executor_main(void *arg)
    {
      pthread_t th;

      DBUG_PRINT("evex main thread",("mark_last_executed"));
      et->mark_last_executed();
      et->compute_next_execution_time();
      DBUG_PRINT("evex main thread", ("[%10s] this exec at [%llu]", et->name.str,
                               TIME_to_ulonglong_datetime(&et->execute_at)));
      et->mark_last_executed(thd);
      if (et->compute_next_execution_time())
      {
        sql_print_error("Error while computing time of %s.%s . "
                        "Disabling after execution.",
                        et->dbname.str, et->name.str);
        et->status= MYSQL_EVENT_DISABLED;
      }
      DBUG_PRINT("evex main thread", ("[%10s] next exec at [%llu]", et->name.str,
                               TIME_to_ulonglong_datetime(&et->execute_at)));

      et->update_fields(thd);
      DBUG_PRINT("info", ("  Spawning a thread %d", ++iter_num));
#ifndef DBUG_FAULTY_THR
@@ -605,7 +615,12 @@ evex_load_events_from_db(THD *thd)
    }
    
    // let's find when to be executed  
    et->compute_next_execution_time();
    if (et->compute_next_execution_time())
    {
      sql_print_error("Error while computing execution time of %s.%s. Skipping",
                       et->dbname.str, et->name.str);
      continue;
    }
    
    DBUG_PRINT("evex_load_events_from_db", ("Adding to the exec list."));

Loading