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.
This is the first cut of separating Event_scheduler in two
classes which are more specialized.
Inheritance was used to separate methods and member variables.
Still Event_scheduler is a child of Event_queue. This dependency
will be removed soon.
Parsing of CREATE/ALTER EVENT statement was crashing because of early
initialization done during parsing, instead in the after parsing phase.
Moreover, we don't want SUBqueries in CREATE/ALTER EVENT therefore we
disable them, though it is possible to make them work. It can be emulated
inside SP with a cursor and SP variable (CREATE/ALTER EVENT can still
accept variables as values).
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
Cut 7 (refactoring)
db_repository is no more embedded in the Events
singleton. Therefore a change to Events_db_repository
won't mean recompile of all files in the server which include events.h
5th cut, moved DB related code to Event_db_repository and
updated accordingly the remanining code.
Moved change/restore_security_context() to class THD
Removed events_priv.h
Next step is to reorganize create/update_event() and parsing for them.
But probably some other refactoring could be done in the meanwhile.
The changes so far pass the test suite.
the parsing. Next step will be to refactor of usage of Event_timed
during Events::create_event() and Events::update_event().
Disallow:
- CREATE EVENT ... DO CREATE EVENT ...;
- ALTER EVENT ... DO CREATE EVENT ...;
- CREATE EVENT ... DO ALTER EVENT DO ....;
- CREATE PROCEDURE ... BEGIN CREATE EVENT ... END|
Allowed:
- CREATE EVENT ... DO DROP EVENT yyy;
- CREATE EVENT ... DO ALTER EVENT yyy;
(the nested ALTER EVENT can have anything but DO clause)
- ALTER EVENT ... DO ALTER EVENT yyy;
(the nested ALTER EVENT can have anything but DO clause)
- ALTER EVENT ... DO DROP EVENT yyy;
- CREATE PROCEDURE ... BEGIN ALTER EVENT ... END|
(the nested ALTER EVENT can have anything but DO clause)
- CREATE PROCEDURE ... BEGIN DROP EVENT ... END|
Third cut to simplify parsing phase. Now DROP EVENT works.
Overloaded few functions to be able to use either sp_name or pass two LEX_STRINGs
instead of a Event_timed pointer. This is transitional and eventually the old
functions will be removed. For now DROP EVENT also works, does not need anymore
a parsing object (Event_timed) and definer initialization because everyone who
has EVENT_ACL can drop events, and this is checked on execution time in sql_parse.cc
from the security context, as it should be.
The 250 simultaneous events all accessing the same table caused the
events_stress test to fail due to debug warnings about too many table
waiters. Fixed by using three different tables.
Start test case with a dummy table create and drop. This ensures that
NDB event subscription is properly set up before the real test starts,
which otherwise could sometimes cause INSERT events to be lost.
alter event rename".
ALTER EVENT ... RENAME statement hasn't checked privileges
for the target database. It also caused server crashes when
target database was not specified explicitly and there was
no current database.
This fix adds missing privilege check and check for the case
when target database is not specified explicitly or implicitly.
The problem was a call to convert_dirname() with a destination buffer
that did not have room for the trailing slash added by that function.
This could cause the instance manager to crash in some cases.