(pre-push cleanups removing debugging code)
sql/event.cc:
- comment
- fix 80 cols
- fix a crash when dropping a running event (after it has finished
its work because the memory got freed in remove_from_cache but the event
was still running)
sql/event.h:
- add new method
sql/event_executor.cc:
- remove printf-s
- fix 80cols
- fix message
- improve the stability of the executor
- make create event if not exists work as before
sql/event.cc:
refactoring:
- have only 1 routine for comparing TIME structures
fix:
- after previous refactoring IF NOT EXISTS of CREATE EVENT did not work
anymore. Now it will work.
sql/event.h:
update definitions
sql/event_executor.cc:
- don't load DISABLED events
- if an event is being disabled because of time restrictions - drop it from the
prio queue
- move dropping to the worker process
sql/event_priv.h:
- remove unneeded func
sql/share/errmsg.txt:
fix error message
sql/sql_parse.cc:
- support 0 rows affected when CREATE EVENT IF NOT EXISTS
- fix one bug found by PeterG, namely bug #51
#there is a major problem currently after removing the specialised DYNAMIC_ARRAY as
storage for the events. I have to reintroduce similar storage, this time probably some
linked list or maybe some API on top of DYNAMIC_ARRAY.
sql/event.cc:
close the table
sql/event.h:
change definition
sql/event_executor.cc:
don't start the thread in advance
sql/event_timed.cc:
- don't call evex_drop_event
- quote the name during compilation to make create event `the rain in spain goes into the drain` not fail.
QUEUE implementation working now. this should be ready more or less
for testing once the debug output is being cleaned and some things
around DYNAMIC_ARRAY are cleaned
- fix handling in case of errors that lead to crashes, now no more crashes
in case of table corruption and such.
include/queues.h:
introduce a safe version of queue_insert that will extend the queue if
necessary. the auto_extent is passed to the _ex version of init_queue()
mysys/queues.c:
add init_queue_ex() implementation
add queue_insert_safe() implementation
sql/event.cc:
- move mysql_priv.h inclusion to event_priv.h
- use a priority queue instead of DYNAMIC_ARRAY which is sorted
sql/event.h:
reorder
sql/event_executor.cc:
reorder
sql/event_priv.h:
- reorder a bit
- add macroses and functions for queue manipulation which stay on top
of QUEUE (partly implemented for DYNAMIC_ARRAY but will be cleared to be
only for QUEUE).
sql/event_timed.cc:
allocate one more byte and zeroterminate, really
- fix a bug introduced with last commit ALTER EVENT a RENAME TO b; failed
- misc
sql/event.cc:
- rename evex_db_find_routine_aux() to evex_db_find_event_aux() (better name)
- change parameter order of db_update_event()
- last bits to handle errors as close as possible to the place they occur
- fix a bug introduced with last commit: first check for overwriting and event and then
check whether the original one exists
sql/event.h:
add a new error code returned by event_timed::compile() in case of
error
sql/event_priv.h:
rename
sql/event_timed.cc:
- function rename
- add a bit of doc
sql/share/errmsg.txt:
- extend an error message so it's more informative
- add a new error message
sql/sql_parse.cc:
refactor the cases for CREATE/ALTER/DROP event so use as much common
code as possible. last bits of error checking unneeded in sql_parse.cc
thrwon out.
(strip m_ as prefix from member variables' names)
sql/event.cc:
- change copyright years
- remove m_ prefix from member variables (I liked m_)
- reorder parameter in evex_update_event()
sql/event.h:
- change copyright years
- remove m_ prefix from member variables
- declare some member variables as private (were public)
- delete 0 is valid in C++ therefore don't embrace with if()
sql/event_executor.cc:
- executor => scheduler in messages
- fix a bug introduced in last commit -> typo in a mutex name
- remove m_ prefix from member variables
sql/event_priv.h:
- change copyright years
sql/event_timed.cc:
- change copyright years
- strip m_ as prefix from member variables' names
sql/sql_parse.cc:
- strip m_ as prefix from member variables' names
sql/sql_yacc.yy:
- strip m_ as prefix from member variables names
sql/event.cc:
-my_error() as close as possible to the place where the error
occurs.
-a thought how to replicate events
-use close_thread_tables() in some cases and for others rely on
this call being done in sql_parse.cc::do_command()
sql/event.h:
remove redundant defines
sql/event_executor.cc:
- reenable the compilation again
- don't backup the open_tables_state, it's not needed
sql/event_timed.cc:
- inline a bit
- comment added
sql/mysqld.cc:
- start mysqld with --event-scheduler=0 by default
sql/share/errmsg.txt:
3 new messages
sql/sql_parse.cc:
remove now obsolete error checking - the errors are reported
as closer as possible to the place where they are detected
sql/sql_yacc.yy:
add WARNING message. fix a bug that was corrupting
thd->client_capabilites ->
select count(*) from mysql.event
was reporting : "Unknown table test.event"!!!
Using temporal variable is nice but IMO quite error-prone.
updated sources
sql/event.cc:
update
put some error calls to the places they occur
sql/event.h:
- change the default (does not work in STRICT mode)
sql/event_executor.cc:
move mutex initialization to evex_init_mutexes so init_events() can be reused when the
main thread does not work and set global event_scheduler=1; (this will start the thread)
The main thread is now visible with show processlist and can be killed.
sql/event_priv.h:
don't use anymore SP for opening table
sql/event_timed.cc:
don't use anymore SP routines for opening mysql.event
sql/mysqld.cc:
shutdown_events() should be maximal at the end of the server because
it destroys mutexes of EVEX. The call should not be in the main thread.
sql/set_var.cc:
make sys_var_event_executor subclass sys_var_bool_ptr
to overload ::update() method - needed to start a
killed (non-running) evex main thread
sql/set_var.h:
declare class sys_var_event_executor
sql/share/errmsg.txt:
2 new messages
- split into several files
- forbid parallel execution (before analyse is done how to make it possible)
because the same sp_head instance cannot be executed in parallel
- added GPL headers
- changed EVENT_ACL to be per DB variable
- fixed minor problems
mysql-test/lib/init_db.sql:
WL#1034 updated
- add Event_priv to mysql.user (update test)
- add updated mysql.event table struct
scripts/mysql_fix_privilege_tables.sql:
WL#1034 updated
add updated mysql.event structure
sql/Makefile.am:
split event.cc into
- event.cc (create/alter/drop)
- event_executor.cc (main and worker threads)
- event_timed.cc (class event_timed)
- event_priv.h (some definitions used internally by the module)
sql/event.cc:
- added GPL header
- split into few files
- fixed some issues after code review
- now using SP routines for opening/traversing/closing tables
(will be reverted)
sql/event.h:
- add GPL header
- remove two methods - inline them in sql_yacc.yy
- don't use absolute values for EVEX_ defines but the SP_ equivalents (have to move 100% to SP_
defines and as later step to not transfer messages upwards in the stack but
report them at the place they occur)
- updated reference table definition
- move default mem_root param from event.cc to the header
sql/mysqld.cc:
WL#1034
rename --event-executor to --event-scheduler
executor sounds a bit scary :)
sql/set_var.cc:
rename internal variable name from event_executor to event_scheduler
(ppl won't be scarried anymore :)
sql/share/errmsg.txt:
omit one %s - not needed
sql/sp_head.cc:
disable this DBUG_PRINT for a bit. m_next_cached_sp is 0x0 and I get crash here...
sql/sp_head.h:
remove m_old_cmq, a temporal variable is used in sql_yacc.yy (Serg's idea)
to keep the previous state.
$<ulong_val>$ = ....
YYTHD->client_capabilites != $<ulong_val>4;
(the same is done also for class event_timed)
sql/sql_acl.cc:
handle pre-5.1.4 table and give the user EVENT_ACL if he had CREATE_ACL
sql/sql_acl.h:
fix the bitmask
sql/sql_parse.cc:
- move from EVENT_ACL being global to EVENT_ACL being per DB like
CREATE_PROC_ACL
- lex->m_qname dropped, because not needed, fix code therefore
- add comment that SHOW CREATE EVENT has to be implemented
sql/sql_yacc.yy:
- use temporal variable of Bison to store a short lived value
- fix indentation
- inline 2 class event_timed methods in the parser
sql/tztime.h:
be more expressive - it's already extern