Commit 57dc1256 authored by unknown's avatar unknown
Browse files

Trivial cleanups and whitespace change in Event Scheduler code.

A larger patch is to come, this is to exclude rudimentary changes
from it.


sql/event_data_objects.cc:
  Whitespace change.
sql/event_data_objects.h:
  Remove debug allocators - we have safemalloc.
sql/event_db_repository.cc:
  Whitespace change.
sql/event_db_repository.h:
  Whitespace change.
sql/event_queue.cc:
  Remove an unused structure. Whitespace change.
sql/event_queue.h:
  Whitespace.
sql/event_scheduler.cc:
  Whitespace change.
sql/event_scheduler.h:
  Add comments. Whitespace change.
sql/events.cc:
  Whitespace change.
sql/events.h:
  Trivial cleanups.
parent 8ed9a540
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -1382,7 +1382,6 @@ Event_queue_element::compute_next_execution_time()
    DBUG_PRINT("info", ("Dropped: %d", dropped));
    status= Event_queue_element::DISABLED;
    status_changed= TRUE;
    dropped= TRUE;

    goto ret;
  }
@@ -1762,7 +1761,7 @@ Event_timed::get_create_event(THD *thd, String *buf)
*/

int
Event_job_data::get_fake_create_event(THD *thd, String *buf)
Event_job_data::get_fake_create_event(String *buf)
{
  DBUG_ENTER("Event_job_data::get_create_event");
  /* FIXME: "EVERY 3337 HOUR" is asking for trouble. */
@@ -1878,7 +1877,7 @@ Event_job_data::compile(THD *thd, MEM_ROOT *mem_root)

  show_create.length(0);

  switch (get_fake_create_event(thd, &show_create)) {
  switch (get_fake_create_event(&show_create)) {
  case EVEX_MICROSECOND_UNSUP:
    DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
  case 0:
+1 −19
Original line number Diff line number Diff line
@@ -127,24 +127,6 @@ class Event_queue_element : public Event_basic

  bool
  update_timing_fields(THD *thd);

  static void *operator new(size_t size)
  {
    void *p;
    DBUG_ENTER("Event_queue_element::new(size)");
    p= my_malloc(size, MYF(0));
    DBUG_PRINT("info", ("alloc_ptr: 0x%lx", (long) p));
    DBUG_RETURN(p);
  }

  static void operator delete(void *ptr, size_t size)
  {
    DBUG_ENTER("Event_queue_element::delete(ptr,size)");
    DBUG_PRINT("enter", ("free_ptr: 0x%lx", (long) ptr));
    TRASH(ptr, size);
    my_free((gptr) ptr, MYF(0));
    DBUG_VOID_RETURN;
  }
};


@@ -206,7 +188,7 @@ class Event_job_data : public Event_basic
  compile(THD *thd, MEM_ROOT *mem_root);
private:
  int
  get_fake_create_event(THD *thd, String *buf);
  get_fake_create_event(String *buf);

  Event_job_data(const Event_job_data &);       /* Prevent use of these */
  void operator=(Event_job_data &);
+7 −17
Original line number Diff line number Diff line
@@ -32,16 +32,6 @@
#define LOCK_QUEUE_DATA()   lock_data(SCHED_FUNC, __LINE__)
#define UNLOCK_QUEUE_DATA() unlock_data(SCHED_FUNC, __LINE__)

struct event_queue_param
{
  THD *thd;
  Event_queue *queue;
  pthread_mutex_t LOCK_loaded;
  pthread_cond_t COND_loaded;
  bool loading_finished;
};


/*
  Compares the execute_at members of two Event_queue_element instances.
  Used as callback for the prioritized queue when shifting
@@ -183,7 +173,7 @@ Event_queue::deinit_queue()
}


/*
/**
  Adds an event to the queue.

  SYNOPSIS
+8 −8
Original line number Diff line number Diff line
@@ -458,7 +458,7 @@ Event_scheduler::start()
  scheduler_thd= new_thd;
  DBUG_PRINT("info", ("Setting state go RUNNING"));
  state= RUNNING;
  DBUG_PRINT("info", ("Forking new thread for scheduduler. THD: 0x%lx", (long) new_thd));
  DBUG_PRINT("info", ("Forking new thread for scheduler. THD: 0x%lx", (long) new_thd));
  if (pthread_create(&th, &connection_attrib, event_scheduler_thread,
                    (void*)scheduler_param_value))
  {
@@ -525,7 +525,7 @@ Event_scheduler::run(THD *thd)
                        "event_name=0x%lx", (long) event_name));
    if (event_name)
    {
      if ((res= execute_top(thd, event_name)))
      if ((res= execute_top(event_name)))
        break;
    }
    else
@@ -559,7 +559,7 @@ Event_scheduler::run(THD *thd)
*/

bool
Event_scheduler::execute_top(THD *thd, Event_queue_element_for_exec *event_name)
Event_scheduler::execute_top(Event_queue_element_for_exec *event_name)
{
  THD *new_thd;
  pthread_t th;
@@ -631,7 +631,7 @@ Event_scheduler::is_running()
}


/*
/**
  Stops the scheduler (again). Waits for acknowledgement from the
  scheduler that it has stopped - synchronous stopping.

+9 −3
Original line number Diff line number Diff line
@@ -15,6 +15,12 @@
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/*
  This file is internal to Events module. Please do not include it directly.
  All public declarations of Events module are in events.h and
  event_data_objects.h.
*/


class Event_queue;
class Event_job_data;
@@ -99,7 +105,7 @@ class Event_scheduler

  /* helper functions */
  bool
  execute_top(THD *thd, Event_queue_element_for_exec *event_name);
  execute_top(Event_queue_element_for_exec *event_name);

  /* helper functions for working with mutexes & conditionals */
  void
Loading