mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
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
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "mysql_priv.h"
|
||||
#include <mysys_err.h>
|
||||
#include "sp.h"
|
||||
#include "event.h"
|
||||
#include <my_dir.h>
|
||||
#include <m_ctype.h>
|
||||
#ifdef __WIN__
|
||||
@@ -748,6 +749,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
||||
|
||||
exit:
|
||||
(void)sp_drop_db_routines(thd, db); /* QQ Ignore errors for now */
|
||||
(void)evex_drop_db_events(thd, db); /* QQ Ignore errors for now */
|
||||
start_waiting_global_read_lock(thd);
|
||||
/*
|
||||
If this database was the client's selected database, we silently change the
|
||||
|
||||
Reference in New Issue
Block a user