summaryrefslogtreecommitdiff
path: root/sql/event_priv.h
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2006-02-16 00:43:11 +0100
committerunknown <andrey@lmy004.>2006-02-16 00:43:11 +0100
commitfea4742db5b5f5531b0e2d30ccee7883f54b0e80 (patch)
tree7ade9988cce658b1efc550ee4228f4bef4a4d6d8 /sql/event_priv.h
parent7088b39da895cf22a2b71d21a8313cbf0dda3760 (diff)
downloadmariadb-git-fea4742db5b5f5531b0e2d30ccee7883f54b0e80.tar.gz
fix for bug#16406 (Events: DROP DATABASE doesn't automatically drop events)
WL#1034 - This changeset also changes the executor so its quite more stable now. Stressing test case added that executes ~800 events per second and dropping hundreds of events at once using DROP DATABASE. (with fixes after review of JimW) (with fixes after review of Serg) mysql-test/r/events.result: update results after TRIGGER_ACL was added mysql-test/t/events.test: -redundant line sql/event.cc: Implemented evex_db_drop_events() which drops all events from a specific database. Needed for SQLCOM_DROP_DATABASE sql/event.h: - protect the event better (see the changes to event_executor.cc and event.cc). An event object could be used in a spawned thread before it's executed but till now the object is marked as being executed when the anonymous sp_head is executed. However, there are timeframes before and after that during which the event is not marked as executed and other thread may delete the object -> so we end with a nirvana pointer. sql/event_executor.cc: - extract some of the code executed in the main thread to a function. Too long functions are bad for the overview. - prepend all information/error messages to the console with "SCHEDULER:" for better overview, and easied searching in the log tables. sql/event_priv.h: - change the name, of evex_db_find_event_by_name() and don't used C++ features like function overloading - define consts for result returned from event_timed::spawn_now() sql/event_timed.cc: - add few methods related to event execution. now the event spawns the worker thread and passes itself as parameter. This way it locks itself for exectution first and then spawning -> no race condition. When the worker thread has finished working with the reference it calls back event_timed::spawn_thread_finish() to unlock itself. sql/sql_db.cc: - call evex_drop_db_events() on DROP DATABASE
Diffstat (limited to 'sql/event_priv.h')
-rw-r--r--sql/event_priv.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/event_priv.h b/sql/event_priv.h
index 7d1cdbcd264..7bcb26aaed0 100644
--- a/sql/event_priv.h
+++ b/sql/event_priv.h
@@ -19,6 +19,10 @@
#include "mysql_priv.h"
+#define EVENT_EXEC_STARTED 0
+#define EVENT_EXEC_ALREADY_EXEC 1
+#define EVENT_EXEC_CANT_FORK 2
+
#define EVEX_USE_QUEUE
#define UNLOCK_MUTEX_AND_BAIL_OUT(__mutex, __label) \
@@ -32,10 +36,10 @@ int
my_time_compare(TIME *a, TIME *b);
int
-evex_db_find_event_aux(THD *thd, const LEX_STRING dbname,
- const LEX_STRING rname,
- const LEX_STRING definer,
- TABLE *table);
+evex_db_find_event_by_name(THD *thd, const LEX_STRING dbname,
+ const LEX_STRING ev_name,
+ const LEX_STRING user_name,
+ TABLE *table);
int
event_timed_compare_q(void *vptr, byte* a, byte *b);