summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.h
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2006-07-04 18:44:35 +0200
committerunknown <andrey@lmy004.>2006-07-04 18:44:35 +0200
commita5dfeb02e991e6e5e9e332443522de1bb4592df8 (patch)
tree4459403077605a188dd88b131d998654761070d2 /sql/event_scheduler.h
parent377446fa3497ffbc0f2a17614d848bfb79f52662 (diff)
downloadmariadb-git-a5dfeb02e991e6e5e9e332443522de1bb4592df8.tar.gz
WL #3337 (Event scheduler new architecture)
Cut Nr. 8. All tests pass. Separated Event_scheduler into Event_queue and Event_scheduler. Added new Event_scheduler_ng which is the new scheduler and is used system-wide. Will be moved to the event_scheduler.cc in the future. Using Event_timed in Event_queue as well as cloned during execution. Next step is to have Event_worker_data which will be used during execution and will take ::compile()/::execute() out of Event_timed. mysql-test/r/events.result: update result mysql-test/r/events_bugs.result: update result mysql-test/r/ps_1general.result: update result mysql-test/r/skip_name_resolve.result: update result mysql-test/r/sp-threads.result: update result mysql-test/r/sp_notembedded.result: update result mysql-test/r/status.result: update result mysql-test/t/events_stress.test: Make event_stress a bit longer sql/Makefile.am: Add new event_scheduler_ng.h/cc . These are only to be in the experimental clone. Later their content will be moved to event_scheduler.h/cc sql/event_data_objects.cc: Allocate strings memory on own memory root, instead on the schedulers. Thus don't "leak" memory. This should fix bug#18683 memory leak in event scheduler sql/event_data_objects.h: add mem_root add THD - this is only temporal, will be moved to class Event_job_data once Event_job_data is responsible for the execution. sql/event_db_repository.cc: Remove unused code. Cosmetic changes sql/event_queue.cc: Now use the Event_scheduler_ng (NextGen) sql/event_queue.h: Now use the Event_scheduler_ng (NextGen) sql/event_scheduler.cc: This file is no more used, but will be soon. sql/event_scheduler.h: This file is no more used but will be soon sql/events.cc: Now use the Event_scheduler_ng (NextGen) sql/events.h: Now use the Event_scheduler_ng (NextGen) sql/mysqld.cc: Make it again possible to kill the scheduler thread sql/set_var.cc: Now use the Event_scheduler_ng (NextGen) sql/share/errmsg.txt: Shorten the message. sql/sql_show.cc: Loading is on a own root, then don't use thd->mem_root
Diffstat (limited to 'sql/event_scheduler.h')
-rw-r--r--sql/event_scheduler.h31
1 files changed, 22 insertions, 9 deletions
diff --git a/sql/event_scheduler.h b/sql/event_scheduler.h
index b4007d88976..7d02e98d4fe 100644
--- a/sql/event_scheduler.h
+++ b/sql/event_scheduler.h
@@ -19,6 +19,7 @@
class sp_name;
class Event_timed;
class Event_db_repository;
+class Event_queue;
class THD;
@@ -31,7 +32,7 @@ events_shutdown();
#include "event_queue.h"
#include "event_scheduler.h"
-class Event_scheduler : public Event_queue
+class Event_scheduler
{
public:
enum enum_state
@@ -56,7 +57,13 @@ public:
static void
- create_instance();
+ create_instance(Event_queue *queue);
+
+ static void
+ init_mutexes();
+
+ static void
+ destroy_mutexes();
/* Singleton access */
static Event_scheduler*
@@ -122,6 +129,8 @@ public:
void
queue_changed();
+ Event_queue *event_queue;
+
protected:
uint
@@ -147,9 +156,11 @@ protected:
/* Singleton DP is used */
Event_scheduler();
-
+ pthread_mutex_t LOCK_data;
pthread_mutex_t *LOCK_scheduler_data;
-
+
+ /* The MEM_ROOT of the object */
+ MEM_ROOT scheduler_root;
/* Set to start the scheduler in suspended state */
bool start_scheduler_suspended;
@@ -172,18 +183,20 @@ protected:
COND_LAST
};
- uint mutex_last_locked_at_line_nr;
- uint mutex_last_unlocked_at_line_nr;
- const char* mutex_last_locked_in_func_name;
- const char* mutex_last_unlocked_in_func_name;
+ uint mutex_last_locked_at_line;
+ uint mutex_last_unlocked_at_line;
+ const char* mutex_last_locked_in_func;
+ const char* mutex_last_unlocked_in_func;
int cond_waiting_on;
bool mutex_scheduler_data_locked;
-
static const char * const cond_vars_names[COND_LAST];
pthread_cond_t cond_vars[COND_LAST];
+ /* Singleton instance */
+ static Event_scheduler *singleton;
+
private:
/* Prevent use of these */
Event_scheduler(const Event_scheduler &);