mariadb/mysql-test/t/events_1.test

413 lines
14 KiB
Text
Raw Normal View History

# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
--disable_warnings
drop database if exists events_test;
drop database if exists db_x;
drop database if exists mysqltest_db2;
drop database if exists mysqltest_no_such_database;
--enable_warnings
create database events_test;
use events_test;
#
# START: BUG #17289 Events: missing privilege check for drop database
#
CREATE USER pauline@localhost;
CREATE DATABASE db_x;
GRANT EVENT ON db_x.* TO pauline@localhost;
USE db_x;
CREATE TABLE x_table(a int);
connect (priv_conn,localhost,pauline,,db_x);
CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x;
CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
connection default;
SHOW DATABASES LIKE 'db_x';
SET GLOBAL event_scheduler=1;
WL#3337 (Events new architecture) Small updates before patch submit. client/mysqltest.c: allow --valgrind option to mysqltest so one can be able to detect whether the test is running under valgrind by having $VALGRIND_TEST, similar to BIG_TEST, in the test file. mysql-test/mysql-test-run.pl: If the test suite is running under valgrind start mysqltest with --valgrind to inform that we run valgrind. mysqltest will provide $VALGRIND_TEST for the test cases. mysql-test/r/events_bugs.result: update result mysql-test/r/events_scheduling.result: update result mysql-test/t/events.test: Increase times or the test will fail under valgrind mysql-test/t/events_bugs.test: Increase times or the test will fail under valgrind mysql-test/t/events_scheduling.test: Remove faulty test Disable the test case for valgrind sql/event_data_objects.cc: count the number of executions sql/event_data_objects.h: flags is not used at all add execution_count to count the number of executions sql/event_db_repository.cc: Initialize wherever needed. Add a comment regarding valgrind warning. sql/event_queue.cc: more debug info in the trace log sql/event_scheduler.cc: Use macro COND_STATE_WAIT() in all cases we need waiting on condition. Hence, we can trace locking, attemption to lock and more with SHOW SCHEDULER STATUS sql/event_scheduler.h: Change the declaration of cond_wait to accept THD sql/events.cc: fix memory leak. Destroy event_queue mysql-test/include/not_valgrind.inc: New BitKeeper file ``mysql-test/include/not_valgrind.inc'' mysql-test/r/not_valgrind.require: New BitKeeper file ``mysql-test/r/not_valgrind.require''
2006-07-17 16:52:45 +02:00
--sleep 1.2
SHOW DATABASES LIKE 'db_x';
SHOW TABLES FROM db_x;
WL#3337 (Event scheduler new architecture) 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.
2006-09-01 13:08:44 +02:00
SET GLOBAL event_scheduler=off;
connection priv_conn;
DROP EVENT e_x1;
DROP EVENT e_x2;
disconnect priv_conn;
connection default;
DROP DATABASE db_x;
DROP USER pauline@localhost;
USE events_test;
#
# END: BUG #17289 Events: missing privilege check for drop database
#
WL#3337 (Event scheduler new architecture) 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.
2006-09-01 13:08:44 +02:00
SET GLOBAL event_scheduler=off;
2005-12-02 13:28:14 +01:00
drop event if exists event1;
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
alter event event1 rename to event2 enable;
alter event event2 disable;
alter event event2 enable;
alter event event2 on completion not preserve;
delimiter __;
alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
delimiter ;__
alter event event3 rename to event2;
2005-12-02 13:28:14 +01:00
drop event event2;
create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
drop event event2;
#
# BUG #16537 (Events: mysql.event.starts is null)
#
CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1;
SELECT interval_field, interval_value, body FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test ON SCHEDULE AT '2020-02-02 20:00:02';
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test COMMENT "non-empty comment";
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test COMMENT "";
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
DROP EVENT event_starts_test;
CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '2020-02-02 20:00:02' ENDS '2022-02-02 20:00:02' DO SELECT 2;
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test COMMENT "non-empty comment";
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test COMMENT "";
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
DROP EVENT event_starts_test;
#
#
WL#3337 (Event scheduler new architecture) Fourth cut of refactoring 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| mysql-test/r/events.result: update results mysql-test/r/events_bugs.result: update results mysql-test/t/events.test: use number as error, mysql-test-run does not like the name. will come back to this later, now it's enough to pass the test. disable nested events / events in SP, when the nested event has a body. If no body is provided, namely DROP EVENT or ALTER that changes the characteristics, then these are allowed. mysql-test/t/events_bugs.test: use number as error, mysql-test-run does not like the name. will come back to this later, now it's enough to pass the test. disable nested events / events in SP, when the nested event has a body. If no body is provided, namely DROP EVENT or ALTER that changes the characteristics, then these are allowed. sql/share/errmsg.txt: new message sql/sql_yacc.yy: refactor CREATE EVENT parsing to fit into the structure CREATE DEFINER=xxx EVENT The actual definer part is not used, but parsed, for now. Disable nested CREATE EVENTS, CREATE EVENT inside CREATE PROCEDURE. And an event DDL with body inside an ALTER. This stops the following : - CREATE EVENT ... DO CREATE EVENT ...; - ALTER EVENT ... DO CREATE EVENT ...; - CREATE EVENT ... DO ALTER EVENT DO ....; - CREATE PROCEDURE ... BEGIN CREATE EVENT ... END| This allows: - 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|
2006-06-27 13:15:40 +02:00
create table test_nested(a int);
create event e_43 on schedule every 1 second do set @a = 5;
--error ER_EVENT_RECURSION_FORBIDDEN
alter event e_43 do alter event e_43 do set @a = 4;
WL#3337 (Event scheduler new architecture) Fourth cut of refactoring 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| mysql-test/r/events.result: update results mysql-test/r/events_bugs.result: update results mysql-test/t/events.test: use number as error, mysql-test-run does not like the name. will come back to this later, now it's enough to pass the test. disable nested events / events in SP, when the nested event has a body. If no body is provided, namely DROP EVENT or ALTER that changes the characteristics, then these are allowed. mysql-test/t/events_bugs.test: use number as error, mysql-test-run does not like the name. will come back to this later, now it's enough to pass the test. disable nested events / events in SP, when the nested event has a body. If no body is provided, namely DROP EVENT or ALTER that changes the characteristics, then these are allowed. sql/share/errmsg.txt: new message sql/sql_yacc.yy: refactor CREATE EVENT parsing to fit into the structure CREATE DEFINER=xxx EVENT The actual definer part is not used, but parsed, for now. Disable nested CREATE EVENTS, CREATE EVENT inside CREATE PROCEDURE. And an event DDL with body inside an ALTER. This stops the following : - CREATE EVENT ... DO CREATE EVENT ...; - ALTER EVENT ... DO CREATE EVENT ...; - CREATE EVENT ... DO ALTER EVENT DO ....; - CREATE PROCEDURE ... BEGIN CREATE EVENT ... END| This allows: - 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|
2006-06-27 13:15:40 +02:00
delimiter |;
alter event e_43 do
begin
alter event e_43 on schedule every 5 minute;
insert into test_nested values(1);
end|
delimiter ;|
WL#3337 (Event scheduler new architecture) 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.
2006-09-01 13:08:44 +02:00
set global event_scheduler = on;
WL#3337 (Event scheduler new architecture) 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
2006-07-10 13:44:43 +02:00
--sleep 3
select db, name, body, status, interval_field, interval_value from mysql.event;
drop event e_43;
WL#3337 (Event scheduler new architecture) Fourth cut of refactoring 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| mysql-test/r/events.result: update results mysql-test/r/events_bugs.result: update results mysql-test/t/events.test: use number as error, mysql-test-run does not like the name. will come back to this later, now it's enough to pass the test. disable nested events / events in SP, when the nested event has a body. If no body is provided, namely DROP EVENT or ALTER that changes the characteristics, then these are allowed. mysql-test/t/events_bugs.test: use number as error, mysql-test-run does not like the name. will come back to this later, now it's enough to pass the test. disable nested events / events in SP, when the nested event has a body. If no body is provided, namely DROP EVENT or ALTER that changes the characteristics, then these are allowed. sql/share/errmsg.txt: new message sql/sql_yacc.yy: refactor CREATE EVENT parsing to fit into the structure CREATE DEFINER=xxx EVENT The actual definer part is not used, but parsed, for now. Disable nested CREATE EVENTS, CREATE EVENT inside CREATE PROCEDURE. And an event DDL with body inside an ALTER. This stops the following : - CREATE EVENT ... DO CREATE EVENT ...; - ALTER EVENT ... DO CREATE EVENT ...; - CREATE EVENT ... DO ALTER EVENT DO ....; - CREATE PROCEDURE ... BEGIN CREATE EVENT ... END| This allows: - 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|
2006-06-27 13:15:40 +02:00
drop table test_nested;
--echo "Let's check whether we can use non-qualified names"
create table non_qualif(a int);
create event non_qualif_ev on schedule every 10 minute do insert into non_qualif values (800219);
WL#3337 (Events new architecture) Small updates before patch submit. client/mysqltest.c: allow --valgrind option to mysqltest so one can be able to detect whether the test is running under valgrind by having $VALGRIND_TEST, similar to BIG_TEST, in the test file. mysql-test/mysql-test-run.pl: If the test suite is running under valgrind start mysqltest with --valgrind to inform that we run valgrind. mysqltest will provide $VALGRIND_TEST for the test cases. mysql-test/r/events_bugs.result: update result mysql-test/r/events_scheduling.result: update result mysql-test/t/events.test: Increase times or the test will fail under valgrind mysql-test/t/events_bugs.test: Increase times or the test will fail under valgrind mysql-test/t/events_scheduling.test: Remove faulty test Disable the test case for valgrind sql/event_data_objects.cc: count the number of executions sql/event_data_objects.h: flags is not used at all add execution_count to count the number of executions sql/event_db_repository.cc: Initialize wherever needed. Add a comment regarding valgrind warning. sql/event_queue.cc: more debug info in the trace log sql/event_scheduler.cc: Use macro COND_STATE_WAIT() in all cases we need waiting on condition. Hence, we can trace locking, attemption to lock and more with SHOW SCHEDULER STATUS sql/event_scheduler.h: Change the declaration of cond_wait to accept THD sql/events.cc: fix memory leak. Destroy event_queue mysql-test/include/not_valgrind.inc: New BitKeeper file ``mysql-test/include/not_valgrind.inc'' mysql-test/r/not_valgrind.require: New BitKeeper file ``mysql-test/r/not_valgrind.require''
2006-07-17 16:52:45 +02:00
--sleep 1.1
select * from non_qualif;
drop event non_qualif_ev;
drop table non_qualif;
WL#3337 (Event scheduler new architecture) More small fixes to the API : use LEX_STRING instead of LEX_STRING* and if error then return bool(true) instead of error code. Merged functions. Reduced usage of sp_name. Fixed a lot of function documentation errors. Added function documentation wherever needed. Removed some unused defines and error codes. Next to come is batch rename of Event_scheduler_ng to Event_scheduler. mysql-test/r/events.result: update result mysql-test/r/events_logs_tests.result: update result mysql-test/t/events.test: more test coverage mysql-test/t/events_logs_tests.test: fix test sql/event_data_objects.cc: Cosmetics. Fix function documentation whenever needed. Move Event_job_data::compile() next to Event_job_data::execute() sql/event_data_objects.h: Remove unneeded error codes and defines Move function declarations at the end of the header sql/event_db_repository.cc: Fix function documentation. Event_db_repository::update_event() now uses LEX_STRING *-s instead of sp_name . Lower coupling. sql/event_db_repository.h: Event_db_repository::update_event() now uses LEX_STRING *-s instead of sp_name . Lower coupling. find_event -> find_named_event find_event_by_name is not used externally, merge with load_named_event() sql/event_queue.cc: LEX_STRING* to LEX_STRING Fix comments. Fix and add function documentation. Remove Event_queue::events_count() as it is unused Change get_top_for_execution_if_time() to return status code as return value and the object is in out parameter. sql/event_queue.h: LEX_STRING* to LEX_STRING Fix comments. Fix and add function documentation. Remove Event_queue::events_count() as it is unused Change get_top_for_execution_if_time() to return status code as return value and the object is in out parameter. Try to detect also lock attemptions for deadlocks. sql/event_scheduler_ng.cc: Always execute on thd->mem_root Fix according to changed API of Event_queue::get_top_for_execution_if_time() sql/events.cc: Fix function documentation. Fix code after API changes of internal Event module classes. sql/events.h: sp_name -> LEX_STRINGs sql/sql_parse.cc: Fix according to changed API of Events::show_create_event() sql/sql_yacc.yy: Don't pass NULL as third parameter to sp_head::init_strings()
2006-07-11 18:28:15 +02:00
--error ER_EVENT_DOES_NOT_EXIST
alter event non_existant rename to non_existant_too;
WL#3337 (Event scheduler new architecture) 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.
2006-09-01 13:08:44 +02:00
set global event_scheduler = off;
WL#3337 (Event scheduler new architecture) More small fixes to the API : use LEX_STRING instead of LEX_STRING* and if error then return bool(true) instead of error code. Merged functions. Reduced usage of sp_name. Fixed a lot of function documentation errors. Added function documentation wherever needed. Removed some unused defines and error codes. Next to come is batch rename of Event_scheduler_ng to Event_scheduler. mysql-test/r/events.result: update result mysql-test/r/events_logs_tests.result: update result mysql-test/t/events.test: more test coverage mysql-test/t/events_logs_tests.test: fix test sql/event_data_objects.cc: Cosmetics. Fix function documentation whenever needed. Move Event_job_data::compile() next to Event_job_data::execute() sql/event_data_objects.h: Remove unneeded error codes and defines Move function declarations at the end of the header sql/event_db_repository.cc: Fix function documentation. Event_db_repository::update_event() now uses LEX_STRING *-s instead of sp_name . Lower coupling. sql/event_db_repository.h: Event_db_repository::update_event() now uses LEX_STRING *-s instead of sp_name . Lower coupling. find_event -> find_named_event find_event_by_name is not used externally, merge with load_named_event() sql/event_queue.cc: LEX_STRING* to LEX_STRING Fix comments. Fix and add function documentation. Remove Event_queue::events_count() as it is unused Change get_top_for_execution_if_time() to return status code as return value and the object is in out parameter. sql/event_queue.h: LEX_STRING* to LEX_STRING Fix comments. Fix and add function documentation. Remove Event_queue::events_count() as it is unused Change get_top_for_execution_if_time() to return status code as return value and the object is in out parameter. Try to detect also lock attemptions for deadlocks. sql/event_scheduler_ng.cc: Always execute on thd->mem_root Fix according to changed API of Event_queue::get_top_for_execution_if_time() sql/events.cc: Fix function documentation. Fix code after API changes of internal Event module classes. sql/events.h: sp_name -> LEX_STRINGs sql/sql_parse.cc: Fix according to changed API of Events::show_create_event() sql/sql_yacc.yy: Don't pass NULL as third parameter to sp_head::init_strings()
2006-07-11 18:28:15 +02:00
create event existant on schedule at now() + interval 1 year do select 12;
--error ER_EVENT_ALREADY_EXISTS
alter event non_existant rename to existant;
--error ER_EVENT_SAME_NAME
alter event existant rename to events_test.existant;
drop event existant;
2005-12-02 13:28:14 +01:00
create table t_event3 (a int, b float);
drop event if exists event3;
create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
2005-12-02 13:28:14 +01:00
select count(*) from t_event3;
drop event event3;
WL#1034 update - fix EVENT_ACL problem that GRANT ALL on some_db.* to someone@somewhere did not get to mysql.db - fix crash when the following is executed : CREATE EVENT P() CREATE EVENT E ON SCHEDULER 1 SECOND DO ROLLBACK; (creation works as well as calling P() which creates the event). mysql-test/lib/init_db.sql: - fix init_db.sql so add Event_priv to the database privs, many tests failed because of that ommision - remove the quotes from the column names mysql-test/t/events.test: - fix the small test, don't create own db scripts/mysql_fix_privilege_tables.sql: - fix that sql/event.cc: - be defensive and don't crash if outside has already has opened some table sql/event_executor.cc: - show in SHOW PROCESSLIST - "event_scheduler" as name of the user of the main thread - use "localhost" as the host where event_scheduler comes from - comment out some debug info, fix other debug info sql/event_timed.cc: - enable EVENT creation inside SP. sphead from lex->sphead goes to et->sphead. it's there only if we compile the event. OTOH when doing CREATE PROCEDURE PROC() CREATE EVENT SOME_EV ON SCHEDULE EVERY 1 SECOND DO ROLLBACK; I have only to get the body of the event which is anonymous SP. Before it being "compiled" but then freed without being used because a bit later it is compiled one more time before being put in the events cache. So it was good that the memory structures weren't reused but scrapped out. Now lex->sphead is not needed during event creation but only where the event's body starts and where it ends so to be able at later stage to compile this anonymous SP (the body of the event). sql/sp_head.cc: - copy over a fix to a crash sql/sql_acl.h: - fix privileges. There was _NO_ documentation about that. Another CHUNK had to be created to so EVENT_ACL gets shifted to it's place in the db table. So how this is calculated? EVENT_ACL is 1 << 26. Remember 26, see which poistion in the db table is EVENT_ACL, it's 17, counted from 0. 26 - 17 = 9, then shift it with 9. CHUNKS are created because in some cases some privileges are in chunks and they are shifted at once. There are few chunks of such privileges which has to be shifted to get to exactly the structure of mysql.db table. sql/sql_parse.cc: - ok, we don't care anymore about lex->sphead because our sphead is lex->et->sphead sql/sql_yacc.yy: - bail out if new event_timed returns 0x0 - enable creation of an event inside a SP CREATE PROCEDURE P() CREATE EVENT E ON SCHEDULE EVERY 1 SECOND DO SELECT 1;
2005-12-15 14:12:28 +01:00
drop table t_event3;
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
set names utf8;
#
# SHOW CREATE EVENT test begin
#
CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root6;
create event root7 on schedule every 2 year do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root7;
create event root8 on schedule every '2:5' year_month do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root8;
create event root8_1 on schedule every '2:15' year_month do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root8_1;
create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root9;
create event root10 on schedule every '20:5' day_hour do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root10;
create event root11 on schedule every '20:25' day_hour do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root11;
create event root12 on schedule every '20:25' hour_minute do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root12;
create event root13 on schedule every '25:25' hour_minute do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root13;
create event root13_1 on schedule every '11:65' hour_minute do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root13_1;
create event root14 on schedule every '35:35' minute_second do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root14;
create event root15 on schedule every '35:66' minute_second do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root15;
create event root16 on schedule every '35:56' day_minute do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root16;
create event root17 on schedule every '35:12:45' day_minute do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root17;
create event root17_1 on schedule every '35:25:65' day_minute do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root17_1;
create event root18 on schedule every '35:12:45' hour_second do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root18;
create event root19 on schedule every '15:59:85' hour_second do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root19;
create event root20 on schedule every '50:20:12:45' day_second do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW CREATE EVENT root20;
set names cp1251;
create event <20><><EFBFBD><EFBFBD>21 on schedule every '50:23:59:95' day_second COMMENT '<27><><EFBFBD><EFBFBD> <20> 1251 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' do select 1;
BUG#16420: Events: timestamps become UTC BUG#26429: SHOW CREATE EVENT is incorrect for an event that STARTS NOW() BUG#26431: Impossible to re-create an event from backup if its STARTS clause is in the past WL#3698: Events: execution in local time zone The problem was that local times specified by the user in AT, STARTS and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC, and the original time zone was forgotten. This way, event scheduler couldn't honor Daylight Saving Time shifts, and times shown to the user were also in UTC. Additionally, CREATE EVENT didn't allow times in the past, thus preventing straightforward event restoration from old backups. This patch reworks event scheduler time computations, performing them in the time zone associated with the event. Also it allows times to be in the past. The patch adds time_zone column to mysql.event table. NOTE: The patch is almost final, but the bug#9953 should be pushed first. client/mysqldump.c: Before every CREATE EVENT, output its time zone. mysql-test/include/wait_condition.inc: Add optional $wait_timeout parameter. mysql-test/lib/init_db.sql: Add time_zone column. mysql-test/r/events.result: Update result. mysql-test/r/events_bugs.result: Update result. mysql-test/r/events_grant.result: Update result. mysql-test/r/events_restart_phase1.result: Update result. mysql-test/r/events_scheduling.result: Update result. mysql-test/r/mysqldump.result: Update result. mysql-test/r/ps.result: Update result. mysql-test/r/system_mysql_db.result: Update result. mysql-test/t/events.test: Remove STARTS from the result, as it depends on current time. mysql-test/t/events_bugs.test: Time in the past is no longer an error. mysql-test/t/events_restart_phase1.test: Fill new column 'time_zone' in mysql.event. mysql-test/t/events_scheduling.test: Cleanup: disable event scheduler. scripts/mysql_create_system_tables.sh: Add new column 'time_zone' to mysql.event. scripts/mysql_fix_privilege_tables.sql: Add new column 'time_zone' to mysql.event. sql/event_data_objects.cc: The essence of the change is the following: - for internal times use my_time_t instead of TIME. Assignment and comparison is done now on plain numbers. - in init_execute_at(), init_starts(), init_ends() convert given time to number of seconds since Epoch (aka Unix time, in UTC). - handle time_zone field loading and storing. - in get_next_time(), Unix time is converted back to event time zone, interval is added, and the result is converted to UTC again. - fix Event_timed::get_create_event() to report STARTS and ENDS. - before executing the event body we set thread time zone to the event time zone. sql/event_data_objects.h: Add time_zone member to Event_basic class. Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_db_repository.cc: Add time_zone column handling. Give a warning and do not create an event if its execution time is in the past, and ON COMPLETION NOT PRESERVE is set, because such an event should be dropped by that time. Also, do not allow ALTER EVENT to set execution time in the past when ON COMPLETION NOT PRESERVE is set. sql/event_db_repository.h: Add enum member for new time zone column. sql/event_queue.cc: Replace handling of broken down times with simple handling of my_time_t. sql/event_queue.h: Store internal times in my_time_t (number of seconds since Epoch), rather than in broken down TIME structure. sql/event_scheduler.cc: Add TODO comment. sql/events.cc: Send time_zone column for SHOW CREATE EVENT. sql/share/errmsg.txt: Update error message, and add two more errors. sql/sql_show.cc: Add TIME_ZONE column to the output of SHOW EVENTS. mysql-test/r/events_time_zone.result: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result mysql-test/t/events_time_zone.test: BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 15:31:07 +01:00
--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT <20><><EFBFBD><EFBFBD>21;
Patch for the following bugs: - BUG#11986: Stored routines and triggers can fail if the code has a non-ascii symbol - BUG#16291: mysqldump corrupts string-constants with non-ascii-chars - BUG#19443: INFORMATION_SCHEMA does not support charsets properly - BUG#21249: Character set of SP-var can be ignored - BUG#25212: Character set of string constant is ignored (stored routines) - BUG#25221: Character set of string constant is ignored (triggers) There were a few general problems that caused these bugs: 1. Character set information of the original (definition) query for views, triggers, stored routines and events was lost. 2. mysqldump output query in client character set, which can be inappropriate to encode definition-query. 3. INFORMATION_SCHEMA used strings with mixed encodings to display object definition; 1. No query-definition-character set. In order to compile query into execution code, some extra data (such as environment variables or the database character set) is used. The problem here was that this context was not preserved. So, on the next load it can differ from the original one, thus the result will be different. The context contains the following data: - client character set; - connection collation (character set and collation); - collation of the owner database; The fix is to store this context and use it each time we parse (compile) and execute the object (stored routine, trigger, ...). 2. Wrong mysqldump-output. The original query can contain several encodings (by means of character set introducers). The problem here was that we tried to convert original query to the mysqldump-client character set. Moreover, we stored queries in different character sets for different objects (views, for one, used UTF8, triggers used original character set). The solution is - to store definition queries in the original character set; - to change SHOW CREATE statement to output definition query in the binary character set (i.e. without any conversion); - introduce SHOW CREATE TRIGGER statement; - to dump special statements to switch the context to the original one before dumping and restore it afterwards. Note, in order to preserve the database collation at the creation time, additional ALTER DATABASE might be used (to temporary switch the database collation back to the original value). In this case, ALTER DATABASE privilege will be required. This is a backward-incompatible change. 3. INFORMATION_SCHEMA showed non-UTF8 strings The fix is to generate UTF8-query during the parsing, store it in the object and show it in the INFORMATION_SCHEMA. Basically, the idea is to create a copy of the original query convert it to UTF8. Character set introducers are removed and all text literals are converted to UTF8. This UTF8 query is intended to provide user-readable output. It must not be used to recreate the object. Specialized SHOW CREATE statements should be used for this. The reason for this limitation is the following: the original query can contain symbols from several character sets (by means of character set introducers). Example: - original query: CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1; - UTF8 query (for INFORMATION_SCHEMA): CREATE VIEW v1 AS SELECT 'Hello' AS c1; client/mysqldump.c: Set original character set and collation before dumping definition query. include/my_sys.h: Move out-parameter to the end of list. mysql-test/lib/mtr_report.pl: Ignore server-warnings during the test case. mysql-test/r/create.result: Update result file. mysql-test/r/ctype_cp932_binlog_stm.result: Update result file. mysql-test/r/events.result: Update result file. mysql-test/r/events_bugs.result: Update result file. mysql-test/r/events_grant.result: Update result file. mysql-test/r/func_in.result: Update result file. mysql-test/r/gis.result: Update result file. mysql-test/r/grant.result: Update result file. mysql-test/r/information_schema.result: Update result file. mysql-test/r/information_schema_db.result: Update result file. mysql-test/r/lowercase_view.result: Update result file. mysql-test/r/mysqldump.result: Update result file. mysql-test/r/ndb_sp.result: Update result file. mysql-test/r/ps.result: Update result file. mysql-test/r/rpl_replicate_do.result: Update result file. mysql-test/r/rpl_sp.result: Update result file. mysql-test/r/rpl_trigger.result: Update result file. mysql-test/r/rpl_view.result: Update result file. mysql-test/r/show_check.result: Update result file. mysql-test/r/skip_grants.result: Update result file. mysql-test/r/sp-destruct.result: Update result file. mysql-test/r/sp-error.result: Update result file. mysql-test/r/sp-security.result: Update result file. mysql-test/r/sp.result: Update result file. mysql-test/r/sql_mode.result: Update result file. mysql-test/r/system_mysql_db.result: Update result file. mysql-test/r/temp_table.result: Update result file. mysql-test/r/trigger-compat.result: Update result file. mysql-test/r/trigger-grant.result: Update result file. mysql-test/r/trigger.result: Update result file. mysql-test/r/view.result: Update result file. mysql-test/r/view_grant.result: Update result file. mysql-test/t/events.test: Update test case (new columns added). mysql-test/t/information_schema.test: Update test case (new columns added). mysql-test/t/show_check.test: Test case for SHOW CREATE TRIGGER in prepared statements and stored routines. mysql-test/t/sp-destruct.test: Update test case (new columns added). mysql-test/t/sp.test: Update test case (new columns added). mysql-test/t/view.test: Update test. mysys/charset.c: Move out-parameter to the end of list. scripts/mysql_system_tables.sql: Add new columns to mysql.proc and mysql.event. scripts/mysql_system_tables_fix.sql: Add new columns to mysql.proc and mysql.event. sql/event_data_objects.cc: Support new attributes for events. sql/event_data_objects.h: Support new attributes for events. sql/event_db_repository.cc: Support new attributes for events. sql/event_db_repository.h: Support new attributes for events. sql/events.cc: Add new columns to SHOW CREATE event resultset. sql/mysql_priv.h: 1. Introduce Object_creation_ctx; 2. Introduce SHOW CREATE TRIGGER; 3. Introduce auxilary functions. sql/sp.cc: Add support for new store routines attributes. sql/sp_head.cc: Add support for new store routines attributes. sql/sp_head.h: Add support for new store routines attributes. sql/sql_lex.cc: Generate UTF8-body on parsing/lexing. sql/sql_lex.h: 1. Generate UTF8-body on parsing/lexing. 2. Introduce SHOW CREATE TRIGGER. sql/sql_parse.cc: Introduce SHOW CREATE TRIGGER. sql/sql_partition.cc: Update parse_sql(). sql/sql_prepare.cc: Update parse_sql(). sql/sql_show.cc: Support new attributes for views sql/sql_trigger.cc: Support new attributes for views sql/sql_trigger.h: Support new attributes for views sql/sql_view.cc: Support new attributes for views sql/sql_yacc.yy: 1. Add SHOW CREATE TRIGGER statement. 2. Generate UTF8-body for views, stored routines, triggers and events. sql/table.cc: Introduce Object_creation_ctx. sql/table.h: Introduce Object_creation_ctx. sql/share/errmsg.txt: Add new errors. mysql-test/include/ddl_i18n.check_events.inc: Aux file for test suite. mysql-test/include/ddl_i18n.check_sp.inc: Aux file for test suite. mysql-test/include/ddl_i18n.check_triggers.inc: Aux file for test suite. mysql-test/include/ddl_i18n.check_views.inc: Aux file for test suite. mysql-test/include/have_cp1251.inc: Aux file for test suite. mysql-test/include/have_cp866.inc: Aux file for test suite. mysql-test/include/have_koi8r.inc: Aux file for test suite. mysql-test/include/have_utf8.inc: Aux file for test suite. mysql-test/r/ddl_i18n_koi8r.result: Result file. mysql-test/r/ddl_i18n_utf8.result: Result file. mysql-test/r/have_cp1251.require: Aux file for test suite. mysql-test/r/have_cp866.require: Aux file for test suite. mysql-test/r/have_koi8r.require: Aux file for test suite. mysql-test/r/have_utf8.require: Aux file for test suite. mysql-test/t/ddl_i18n_koi8r.test: Complete koi8r test case for the CS patch. mysql-test/t/ddl_i18n_utf8.test: Complete utf8 test case for the CS patch.
2007-06-28 19:34:54 +02:00
insert into mysql.event (
db,
name,
body,
definer,
interval_value,
interval_field,
originator,
character_set_client,
collation_connection,
db_collation,
body_utf8)
values (
database(),
"root22",
"select 1",
user(),
100,
"SECOND_MICROSECOND",
1,
'utf8',
'utf8_general_ci',
'utf8_general_ci',
'select 1');
--error ER_NOT_SUPPORTED_YET
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
show create event root22;
--error ER_NOT_SUPPORTED_YET
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW EVENTS;
drop event root22;
WL#3337 (Event scheduler new architecture) 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
2006-07-10 13:44:43 +02:00
--error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
create event root23 on schedule every -100 year do select 1;
--error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
create event root23 on schedule every 222222222222222222222 year do select 1;
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
drop event root6;
drop event root7;
drop event root8;
drop event root8_1;
drop event root9;
drop event root10;
drop event root11;
drop event root12;
drop event root13;
drop event root13_1;
drop event root14;
drop event root15;
drop event root16;
drop event root17;
drop event root17_1;
drop event root18;
drop event root19;
drop event root20;
drop event <20><><EFBFBD><EFBFBD>21;
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
set names latin1;
#
# SHOW CREATE EVENT test end
#
#
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
# mysql.event intact checking
# Check that the server does not crash if
# one has destroyed or tampered with the event table.
# Please see see for events_restart_phase* tests to
# see the server behavior at start up with bad mysql.event
# table.
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
#
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
#
--echo Create a test event. Only event metadata is relevant,
--echo the actual schedule and body are not.
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
#
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
--replace_column 8 # 9 #
SHOW EVENTS;
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
#
--echo Try to alter mysql.event: the server should fail to load
--echo event information after mysql.event was tampered with.
--echo
--echo First, let's add a column to the end and make sure everything
--echo works as before
--echo
ALTER TABLE mysql.event ADD dummy INT;
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
--replace_column 8 # 9 #
SHOW EVENTS;
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
SELECT event_name FROM INFORMATION_SCHEMA.events;
--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT intact_check;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT no_such_event;
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT intact_check_1;
DROP EVENT intact_check_2;
DROP EVENT intact_check;
DROP DATABASE IF EXISTS mysqltest_no_such_database;
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
SELECT @@event_scheduler;
SHOW VARIABLES LIKE 'event_scheduler';
SET GLOBAL event_scheduler=OFF;
# Clean up
ALTER TABLE mysql.event DROP dummy;
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
--echo
--echo Now let's add a column to the first position: the server
--echo expects to see event schema name there
--echo
ALTER TABLE mysql.event ADD dummy INT FIRST;
--error ER_CANNOT_LOAD_FROM_TABLE
SHOW EVENTS;
--error ER_CANNOT_LOAD_FROM_TABLE
SELECT event_name FROM INFORMATION_SCHEMA.events;
--error ER_EVENT_DOES_NOT_EXIST
SHOW CREATE EVENT intact_check;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT no_such_event;
#--error ER_CANNOT_LOAD_FROM_TABLE peplaced by:
--error ER_EVENT_STORE_FAILED
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
--error ER_EVENT_DOES_NOT_EXIST
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
--error ER_EVENT_DOES_NOT_EXIST
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT intact_check_1;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT intact_check_2;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT intact_check;
# Should work OK
DROP DATABASE IF EXISTS mysqltest_no_such_database;
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
SELECT @@event_scheduler;
SHOW VARIABLES LIKE 'event_scheduler';
SET GLOBAL event_scheduler=OFF;
--echo Clean up
ALTER TABLE mysql.event DROP dummy;
DELETE FROM mysql.event;
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
--echo Back up the table, further changes are not reversible
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
CREATE TABLE event_like LIKE mysql.event;
INSERT INTO event_like SELECT * FROM mysql.event;
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
--echo
--echo Drop some columns and try more checks.
--echo
--echo
ALTER TABLE mysql.event DROP comment, DROP starts;
--error ER_CANNOT_LOAD_FROM_TABLE
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SHOW EVENTS;
--error ER_CANNOT_LOAD_FROM_TABLE
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
--error ER_CANNOT_LOAD_FROM_TABLE
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
SHOW CREATE EVENT intact_check;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT no_such_event;
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
--error ER_EVENT_DOES_NOT_EXIST
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
--error ER_EVENT_DOES_NOT_EXIST
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT intact_check_1;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT intact_check_2;
# Should succeed
DROP EVENT intact_check;
DROP DATABASE IF EXISTS mysqltest_no_such_database;
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
SELECT @@event_scheduler;
SHOW VARIABLES LIKE 'event_scheduler';
SET GLOBAL event_scheduler=OFF;
--echo
--echo Now drop the table, and test again
--echo
--echo
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
DROP TABLE mysql.event;
A set of changes aiming to make the Event Scheduler more user-friendly when there are no up-to-date system tables to support it: - initialize the scheduler before reporting "Ready for connections". This ensures that warnings, if any, are printed before "Ready for connections", and this message is not mangled. - do not abort the scheduler if there are no system tables - check the tables once at start up, remember the status and disable the scheduler if the tables are not up to date. If one attempts to use the scheduler with bad tables, issue an error message. - clean up the behaviour of the module under LOCK TABLES and pre-locking mode - make sure implicit commit of Events DDL works as expected. - add more tests Collateral clean ups in the events code. This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work when mysql.event is damaged mysql-test/r/events.result: Update results. mysql-test/r/events_bugs.result: Update results. mysql-test/r/events_restart_phase1.result: Update results. mysql-test/r/events_restart_phase2.result: Update results. mysql-test/r/events_restart_phase3.result: Update results. mysql-test/r/events_scheduling.result: Update results. mysql-test/r/events_time_zone.result: Update results. mysql-test/t/events.test: Add new tests for tampering with mysql.event and some more tests for sub-statements, LOCK TABLES mode and pre-locking. mysql-test/t/events_bugs.test: Move the non-concurrent part of test for Bug 16420 to this file. mysql-test/t/events_restart_phase1.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase2.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_restart_phase3.test: Rewrite events_restart_* tests to take into account that now we check mysql.event table only once, at server startup. mysql-test/t/events_scheduling.test: Add more coverage for event_scheduler global variable. mysql-test/t/events_time_zone.test: Move the non-concurrent part of the tests for Bug 16420 to events_bugs.test sql/event_data_objects.cc: Move update_timing_fields functionality to Event_db_repository. Make loading of events from a table record more robust to tampering with the table - now we do not check mysql.event on every table open. sql/event_data_objects.h: Cleanup. sql/event_db_repository.cc: Now Event_db_repository is responsible for table I/O only. All the logic of events DDL is handled outside, in Events class please refer to the added test coverage to see how this change affected the behavior of Event Scheduler. Dependency on sp_head.h and sp.h removed. Make this module robust to tweaks with mysql.event table. Move check_system_tables from events.cc to this file sql/event_db_repository.h: Cleanup declarations (remove unused ones, change return type to bool from int). sql/event_queue.cc: Update to adapt to the new start up scheme of the Event Scheduler. sql/event_queue.h: Cleanup declarations. sql/event_scheduler.cc: Make all the error messages uniform: [SEVERITY] Event Scheduler: [user][schema.event] message Using append_identifier for error logging was an overkill - we may need it only if the system character set may have NUL (null character) as part of a valid identifier, this is currently never the case, whereas additional quoting did not look nice in the log. sql/event_scheduler.h: Cleanup the headers. sql/events.cc: Use a different start up procedure of Event Scheduler: - at start up, try to check the system tables first. If they are not up-to-date, disable the scheduler. - try to load all the active events. In case of a load error, abort start up. - do not parse an event on start up. Parsing only gives some information about event validity, but far not all. Consolidate the business logic of Events DDL in this module. Now opt_event_scheduler may change after start up and thus is protected by LOCK_event_metadata mutex. sql/events.h: Use all-static-data-members approach to implement Singleton pattern. sql/mysqld.cc: New invocation scheme of Events. Move some logic to events.cc. Initialize the scheduler before reporting "Ready for connections". sql/set_var.cc: Clean up sys_var_thd_sql_mode::symbolic_mode_representation to work with a LEX_STRING. Move more logic related to @@events_scheduler global variable to Events module. sql/set_var.h: Update declarations. sql/share/errmsg.txt: If someone tampered with mysql.event table after the server has started we no longer give him/her a complete report what was actually broken. Do not send the user to look at the error log in such case, as there is nothing there (check_table_intact is not executed). sql/sp_head.cc: Update to a new declaration of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_db.cc: New invocation scheme of Events module. sql/sql_parse.cc: Move more logic to Events module. Make sure that we are consistent in the way access rights are checked for Events DDL: always after committing the current transaction and checking the system tables. sql/sql_show.cc: Update to the new declarations of sys_var_thd_sql_mode::symbolic_mode_representation sql/sql_test.cc: New invocation scheme of events. sql/table.cc: mysql.event is a system table. Update check_table_intact to be concurrent, more verbose, and less smart. sql/table.h: Add a helper method. mysql-test/r/events_trans.result: New BitKeeper file ``mysql-test/r/events_trans.result'' mysql-test/t/events_trans.test: New BitKeeper file ``mysql-test/t/events_trans.test'': test cases for Event Scheduler that require a transactional storage engine.
2007-04-05 13:24:34 +02:00
--error ER_NO_SUCH_TABLE
SHOW EVENTS;
--error ER_NO_SUCH_TABLE
SELECT event_name FROM INFORMATION_SCHEMA.events;
--error ER_NO_SUCH_TABLE
SHOW CREATE EVENT intact_check;
--error ER_NO_SUCH_TABLE
DROP EVENT no_such_event;
--error ER_NO_SUCH_TABLE
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
--error ER_NO_SUCH_TABLE
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
--error ER_NO_SUCH_TABLE
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
--error ER_NO_SUCH_TABLE
DROP EVENT intact_check_1;
--error ER_NO_SUCH_TABLE
DROP EVENT intact_check_2;
--error ER_NO_SUCH_TABLE
DROP EVENT intact_check;
DROP DATABASE IF EXISTS mysqltest_no_such_database;
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
--echo OK, there is an unnecessary warning about the non-existent table
--echo but it's not easy to fix and no one complained about it.
--echo A similar warning is printed if mysql.proc is missing.
SHOW WARNINGS;
SELECT @@event_scheduler;
SHOW VARIABLES LIKE 'event_scheduler';
SET GLOBAL event_scheduler=OFF;
--echo Restore the original table.
- final fixes for bug#16431 (Events: An event which alters itself disappears) - fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
2006-02-14 16:20:48 +01:00
CREATE TABLE mysql.event like event_like;
DROP TABLE event_like;
--replace_column 8 # 9 #
SHOW EVENTS;
Fix for 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"
2007-05-26 16:36:38 +02:00
#
# End of tests
#
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where db='events_test' and command = 'Connect' and user=current_user();
--source include/wait_condition.inc
drop database events_test;