Commit 57dc1256 authored by unknown's avatar unknown

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
...@@ -1382,7 +1382,6 @@ Event_queue_element::compute_next_execution_time() ...@@ -1382,7 +1382,6 @@ Event_queue_element::compute_next_execution_time()
DBUG_PRINT("info", ("Dropped: %d", dropped)); DBUG_PRINT("info", ("Dropped: %d", dropped));
status= Event_queue_element::DISABLED; status= Event_queue_element::DISABLED;
status_changed= TRUE; status_changed= TRUE;
dropped= TRUE;
goto ret; goto ret;
} }
...@@ -1762,7 +1761,7 @@ Event_timed::get_create_event(THD *thd, String *buf) ...@@ -1762,7 +1761,7 @@ Event_timed::get_create_event(THD *thd, String *buf)
*/ */
int 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"); DBUG_ENTER("Event_job_data::get_create_event");
/* FIXME: "EVERY 3337 HOUR" is asking for trouble. */ /* FIXME: "EVERY 3337 HOUR" is asking for trouble. */
...@@ -1878,7 +1877,7 @@ Event_job_data::compile(THD *thd, MEM_ROOT *mem_root) ...@@ -1878,7 +1877,7 @@ Event_job_data::compile(THD *thd, MEM_ROOT *mem_root)
show_create.length(0); show_create.length(0);
switch (get_fake_create_event(thd, &show_create)) { switch (get_fake_create_event(&show_create)) {
case EVEX_MICROSECOND_UNSUP: case EVEX_MICROSECOND_UNSUP:
DBUG_RETURN(EVEX_MICROSECOND_UNSUP); DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
case 0: case 0:
......
...@@ -127,24 +127,6 @@ class Event_queue_element : public Event_basic ...@@ -127,24 +127,6 @@ class Event_queue_element : public Event_basic
bool bool
update_timing_fields(THD *thd); 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 ...@@ -206,7 +188,7 @@ class Event_job_data : public Event_basic
compile(THD *thd, MEM_ROOT *mem_root); compile(THD *thd, MEM_ROOT *mem_root);
private: private:
int 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 */ Event_job_data(const Event_job_data &); /* Prevent use of these */
void operator=(Event_job_data &); void operator=(Event_job_data &);
......
...@@ -32,16 +32,6 @@ ...@@ -32,16 +32,6 @@
#define LOCK_QUEUE_DATA() lock_data(SCHED_FUNC, __LINE__) #define LOCK_QUEUE_DATA() lock_data(SCHED_FUNC, __LINE__)
#define UNLOCK_QUEUE_DATA() unlock_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. Compares the execute_at members of two Event_queue_element instances.
Used as callback for the prioritized queue when shifting Used as callback for the prioritized queue when shifting
...@@ -183,7 +173,7 @@ Event_queue::deinit_queue() ...@@ -183,7 +173,7 @@ Event_queue::deinit_queue()
} }
/* /**
Adds an event to the queue. Adds an event to the queue.
SYNOPSIS SYNOPSIS
......
...@@ -458,7 +458,7 @@ Event_scheduler::start() ...@@ -458,7 +458,7 @@ Event_scheduler::start()
scheduler_thd= new_thd; scheduler_thd= new_thd;
DBUG_PRINT("info", ("Setting state go RUNNING")); DBUG_PRINT("info", ("Setting state go RUNNING"));
state= 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, if (pthread_create(&th, &connection_attrib, event_scheduler_thread,
(void*)scheduler_param_value)) (void*)scheduler_param_value))
{ {
...@@ -525,7 +525,7 @@ Event_scheduler::run(THD *thd) ...@@ -525,7 +525,7 @@ Event_scheduler::run(THD *thd)
"event_name=0x%lx", (long) event_name)); "event_name=0x%lx", (long) event_name));
if (event_name) if (event_name)
{ {
if ((res= execute_top(thd, event_name))) if ((res= execute_top(event_name)))
break; break;
} }
else else
...@@ -559,7 +559,7 @@ Event_scheduler::run(THD *thd) ...@@ -559,7 +559,7 @@ Event_scheduler::run(THD *thd)
*/ */
bool 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; THD *new_thd;
pthread_t th; pthread_t th;
...@@ -631,7 +631,7 @@ Event_scheduler::is_running() ...@@ -631,7 +631,7 @@ Event_scheduler::is_running()
} }
/* /**
Stops the scheduler (again). Waits for acknowledgement from the Stops the scheduler (again). Waits for acknowledgement from the
scheduler that it has stopped - synchronous stopping. scheduler that it has stopped - synchronous stopping.
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 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_queue;
class Event_job_data; class Event_job_data;
...@@ -99,7 +105,7 @@ class Event_scheduler ...@@ -99,7 +105,7 @@ class Event_scheduler
/* helper functions */ /* helper functions */
bool 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 */ /* helper functions for working with mutexes & conditionals */
void void
......
...@@ -346,7 +346,6 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists) ...@@ -346,7 +346,6 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists)
pthread_mutex_unlock(&LOCK_event_metadata); pthread_mutex_unlock(&LOCK_event_metadata);
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -444,7 +443,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists) ...@@ -444,7 +443,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
} }
/* /**
Drops all events from a schema Drops all events from a schema
SYNOPSIS SYNOPSIS
...@@ -697,7 +696,7 @@ Events::deinit() ...@@ -697,7 +696,7 @@ Events::deinit()
} }
/* /**
Inits Events mutexes Inits Events mutexes
SYNOPSIS SYNOPSIS
...@@ -755,7 +754,7 @@ Events::dump_internal_status() ...@@ -755,7 +754,7 @@ Events::dump_internal_status()
} }
/* /**
Starts execution of events by the scheduler Starts execution of events by the scheduler
SYNOPSIS SYNOPSIS
......
...@@ -19,7 +19,6 @@ class sp_name; ...@@ -19,7 +19,6 @@ class sp_name;
class Event_parse_data; class Event_parse_data;
class Event_db_repository; class Event_db_repository;
class Event_queue; class Event_queue;
class Event_queue_element;
class Event_scheduler; class Event_scheduler;
/* Return codes */ /* Return codes */
...@@ -38,6 +37,10 @@ enum enum_events_error_code ...@@ -38,6 +37,10 @@ enum enum_events_error_code
int int
sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs); sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs);
/**
@class Events -- a facade to the functionality of the Event Scheduler.
*/
class Events class Events
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment