* Finished Monty and Jani's merge
* Some InnoDB tests still fail (because it's old xtradb code run against
newer testsuite). They are expected to go after mergning with the latest
xtradb.
Details:
Most tests mentioned within the bug report were already fixed.
The test modified here failed in stability (high parallel load) tests.
Details:
1. Take care that disconnects are finished before the test terminates.
2. Correct wrong handling of send/reap in events_stress which caused
random garbled output
3. Minor beautifying of script code
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/r/events_bugs.result:
uppercase
mysql-test/t/events.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/t/events_bugs.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/t/events_grant.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/t/events_logs_tests.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/t/events_scheduling.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/t/events_stress.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/t/events_time_zone.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/t/events_trans.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
mysql-test/t/events_trans_notembedded.test:
wait at the end of the script for event which haven't
finished their execution. This should solve
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
This is a post-review patch.
Fixes the typelib implementation, available only in 5.1.11.
--event-scheduler cmdline : DISABLED | ON | OFF | 0 | 1
DISABLED - makes the scheduler unavailable during the server run
(ON|1)- When the server is started the scheduler will be started. It can
be stopped and restarted by setting appropriate values to
GLOBAL event_scheduler
(OFF|0)- When the server is started, the scheduler won't be started. It
can be started and again stopped by setting appropriate values to
GLOBAL event_scheduler. _DEFAULT_ value
The GLOBAL variable event_scheduler can have the following values:
OFF | ON | 0 | 1
DISABLED is not possible and every attempt will end with an error that
it's not a valid value for the variable.
OFF | 0 - This is the pre-5.1.11 behavior - The scheduler stops, if not
already stopped, and can be started again by setting
the value of the variable to ON|1.
ON | 1 - This is the pre-5.1.11 behavior - The scheduler starts, if not
already started, and can be stopped again by setting the value
of the variable to OFF|0.
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_restart_phase1.result:
update result
mysql-test/r/events_restart_phase3.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/events.test:
update test:
2 -> off
1 -> on
mysql-test/t/events_bugs.test:
update test:
2 -> off
1 -> on
mysql-test/t/events_logs_tests.test:
update test:
2 -> off
1 -> on
mysql-test/t/events_restart_phase1.test:
update test:
2 -> off
1 -> on
mysql-test/t/events_restart_phase2-master.opt:
update master file : 1 => on
mysql-test/t/events_scheduling.test:
update test:
2 -> off
1 -> on
add tests for event_scheduler global variable representation from
SHOW VARIABLES.
mysql-test/t/events_stress.test:
update test:
2 -> off
1 -> on
sql/events.cc:
Implement two different TYPELIBs for --event-scheduler cmd line
option and for GLOBAL variable event_scheduler
--event-scheduler cmdline : DISABLED | ON | OFF | 0 | 1
DISABLED - makes the scheduler unavailable during the server run
(ON|1)- When the server is started the scheduler will be started. It can
be stopped and restarted by setting appropriate values to
GLOBAL event_scheduler
(OFF|0)- When the server is started, the scheduler won't be started. It
can be started and again stopped by setting appropriate values to
GLOBAL event_scheduler. _DEFAULT_ value
The GLOBAL variable event_scheduler can have the following values:
OFF | ON | 0 | 1
DISABLED is not possible and every attempt will end with an error that
it's not a valid value for the variable.
OFF | 0 - This is the pre-5.1.11 behavior - The scheduler stops, if not
already stopped, and can be started again by setting
the value of the variable to ON|1.
ON | 1 - This is the pre-5.1.11 behavior - The scheduler starts, if not
already started, and can be stopped again by setting the value
of the variable to OFF|0.
sql/events.h:
additional TYPELIB for GLOBAL event_scheduler
sql/mysqld.cc:
--event-scheduler should be checked against a TYPELIB and
therefore should be GET_STR, as well as we make the parameter optional.
When not provided OFF|0 is used.
sql/set_var.cc:
Implement typelib for event_scheduler variable.
If allows both INT_RESULT -> 0 | 1
and STRING_RESULT -> OFF | ON
The variable is shown as DISABLED | ON | OFF
sql/set_var.h:
Implement typelib, which expects both STRING and INT,
for event_scheduler.
BitKeeper/etc/ignore:
auto-union
mysql-test/r/events_logs_tests.result:
Auto merged
mysql-test/t/events_logs_tests.test:
Auto merged
mysql-test/t/events_stress.test:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/event_data_objects.cc:
manual merge
sql/events.cc:
manual merge
This patch introduces specialized Event data objects
Event_basic as parent.
Event_queue_element used for queue storage
Event_timed used for SHOW EVENTS/ I_S.EVENTS / SHOW CREATE EVENT
Event_job_data using during execution.
Methods were moved out of Event_timed to other classes.
This patch also introduces Events::LOCK_event_metadata.
This patch gives new implementation of Events::dump_internal_status().
Now both the Event_scheduler and Event_queue return information during
their ::dump_internal_status().
Shortened a bit the runtime for executing events test cases.
mysql-test/r/events.result:
update results
mysql-test/r/events_bugs.result:
update results
mysql-test/r/events_logs_tests.result:
update results
mysql-test/r/events_scheduling.result:
update results
mysql-test/t/events.test:
update test
make --sleep more appropriate . saving some time could mean failure on loaded boxes though :(
add tests for previously uncovered branches.
mysql-test/t/events_bugs.test:
update test
make --sleep more appropriate . saving some time could mean failure on loaded boxes though :(
add tests for previously uncovered branches.
mysql-test/t/events_logs_tests.test:
make the test shorter by time
mysql-test/t/events_scheduling.test:
when selecting always use ORDER BY
mysql-test/t/events_stress.test:
sleep 2.5secs for shorter stress test
sql/event_data_objects.cc:
Event_timed is no more used during execution.
Event_timed is no more used during in the memory queue.
Event_timed is only used for SHOW CREATE EVENT/ I_S.EVENTS/ SHOW EVENTS
Event_basic is the parent of almost all Event data objects.
Event_basic -> Event_queue_element (used for the memory queue) -> Event_timed
Event_basic -> Event_job_data (the object used for execution)
Sql_alloc -> Event_parse_data (used during parsing)
sql/event_data_objects.h:
Event_timed is no more used during execution.
Event_timed is no more used during in the memory queue.
Event_timed is only used for SHOW CREATE EVENT/ I_S.EVENTS/ SHOW EVENTS
Event_basic is the parent of almost all Event data objects.
Event_basic -> Event_queue_element (used for the memory queue) -> Event_timed
Event_basic -> Event_job_data (the object used for execution)
Sql_alloc -> Event_parse_data (used during parsing)
sql/event_db_repository.cc:
Cosmetics.
load_named_event now uses Event_basic, for polymorphism
find_event uses Event_basic, to be polymorphic.
use Field **fields= table->field and then index fields[...]
Add documentation.
Fix documentation.
sql/event_db_repository.h:
Event_db_repository depends only on Event_basic's interface
sql/event_queue.cc:
Cosmetics.
Don't use Event_timed for the queue and giving back object for execution.
Event_queue_element is for the queue, Event_job_data is for execution.
Add Event_queue::dump_internal_status() for SHOW SCHEDULER STATUS command
sql/event_queue.h:
Cosmetics.
Don't use Event_timed for the queue and giving back object for execution.
Event_queue_element is for the queue, Event_job_data is for execution.
Add Event_queue::dump_internal_status() for SHOW SCHEDULER STATUS command
sql/event_scheduler_ng.cc:
Add back Event_scheduler::cond_wait()
Add back Event_scheduler::dump_internal_status()
Using Event_job_data for execution. Make the scheduler thread unkillable (thd->command= COM_DAEMON).
Add a lot of documentation.
sql/event_scheduler_ng.h:
Add back Event_scheduler::cond_wait()
Add back Event_scheduler::dump_internal_status()
Using Event_job_data for execution.
sql/events.cc:
Documentation
Add LOCK_event_metadata
sql/events.h:
Change the signature of Events::drop_event() not to use sp_name but LEX_STRING
sql/share/errmsg.txt:
Fix error message
sql/sql_parse.cc:
Events::drop_event() has new signature
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
Mark events_stress.test as 'big' as it's very slow on some machines
BitKeeper/etc/ignore:
added server-tools/instance-manager/net_serv.cc
mysql-test/t/events_stress.test:
Slow test: only run when using --big
mysql-test/t/rpl_ndb_auto_inc.test:
Fix failing test
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.
mysql-test/r/events_stress.result:
Use three different MyISAM tables to avoid debug warnings about too many
locks.
mysql-test/t/events_stress.test:
Use three different MyISAM tables to avoid debug warnings about too many
locks.
(fix for bug#20290 Event mechanism incompatible with embedded server, but tests tried)
mysql-test/t/events.test:
disable test in embedded
mysql-test/t/events_bugs.test:
disable test in embedded
mysql-test/t/events_grant.test:
disable test in embedded
mysql-test/t/events_logs_tests.test:
disable test in embedded
mysql-test/t/events_microsec.test:
disable test in embedded
mysql-test/t/events_scheduling.test:
disable test in embedded
mysql-test/t/events_stress.test:
disable test in embedded
drop users at the end of events_stress
mysql-test/r/ps_1general.result:
update result
mysql-test/r/skip_name_resolve.result:
update result
mysql-test/r/sp_notembedded.result:
update result
mysql-test/r/status.result:
update result
mysql-test/t/events_stress.test:
drop users created in the test
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
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