fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
/* Copyright (C) 2004-2006 MySQL AB
|
2005-12-05 11:45:04 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2006-12-27 02:23:51 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2005-12-05 11:45:04 +01:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
2006-03-10 02:37:59 +01:00
|
|
|
#define MYSQL_LEX 1
|
2006-06-08 23:07:11 +02:00
|
|
|
#include "mysql_priv.h"
|
|
|
|
#include "events.h"
|
2006-06-27 08:48:50 +02:00
|
|
|
#include "event_data_objects.h"
|
2006-06-28 01:28:03 +02:00
|
|
|
#include "event_db_repository.h"
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
#include "sp_head.h"
|
|
|
|
|
2007-08-15 17:08:44 +02:00
|
|
|
/**
|
|
|
|
@addtogroup Event_Scheduler
|
|
|
|
@{
|
|
|
|
*/
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
#define EVEX_MAX_INTERVAL_VALUE 1000000000L
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
|
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
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
Event_creation_ctx -- creation context of events.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Event_creation_ctx :public Stored_program_creation_ctx,
|
|
|
|
public Sql_alloc
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static bool load_from_db(THD *thd,
|
|
|
|
MEM_ROOT *event_mem_root,
|
|
|
|
const char *db_name,
|
|
|
|
const char *event_name,
|
|
|
|
TABLE *event_tbl,
|
|
|
|
Stored_program_creation_ctx **ctx);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root)
|
|
|
|
{
|
|
|
|
return new (mem_root)
|
|
|
|
Event_creation_ctx(m_client_cs, m_connection_cl, m_db_cl);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual Object_creation_ctx *create_backup_ctx(THD *thd) const
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
We can avoid usual backup/restore employed in stored programs since we
|
|
|
|
know that this is a top level statement and the worker thread is
|
|
|
|
allocated exclusively to execute this event.
|
|
|
|
*/
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Event_creation_ctx(CHARSET_INFO *client_cs,
|
|
|
|
CHARSET_INFO *connection_cl,
|
|
|
|
CHARSET_INFO *db_cl)
|
|
|
|
: Stored_program_creation_ctx(client_cs, connection_cl, db_cl)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
Event_creation_ctx implementation.
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
bool
|
|
|
|
Event_creation_ctx::load_from_db(THD *thd,
|
|
|
|
MEM_ROOT *event_mem_root,
|
|
|
|
const char *db_name,
|
|
|
|
const char *event_name,
|
|
|
|
TABLE *event_tbl,
|
|
|
|
Stored_program_creation_ctx **ctx)
|
|
|
|
{
|
|
|
|
/* Load character set/collation attributes. */
|
|
|
|
|
|
|
|
CHARSET_INFO *client_cs;
|
|
|
|
CHARSET_INFO *connection_cl;
|
|
|
|
CHARSET_INFO *db_cl;
|
|
|
|
|
|
|
|
bool invalid_creation_ctx= FALSE;
|
|
|
|
|
|
|
|
if (load_charset(event_mem_root,
|
|
|
|
event_tbl->field[ET_FIELD_CHARACTER_SET_CLIENT],
|
|
|
|
thd->variables.character_set_client,
|
|
|
|
&client_cs))
|
|
|
|
{
|
|
|
|
sql_print_warning("Event '%s'.'%s': invalid value "
|
|
|
|
"in column mysql.event.character_set_client.",
|
|
|
|
(const char *) db_name,
|
|
|
|
(const char *) event_name);
|
|
|
|
|
|
|
|
invalid_creation_ctx= TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (load_collation(event_mem_root,
|
|
|
|
event_tbl->field[ET_FIELD_COLLATION_CONNECTION],
|
|
|
|
thd->variables.collation_connection,
|
|
|
|
&connection_cl))
|
|
|
|
{
|
|
|
|
sql_print_warning("Event '%s'.'%s': invalid value "
|
|
|
|
"in column mysql.event.collation_connection.",
|
|
|
|
(const char *) db_name,
|
|
|
|
(const char *) event_name);
|
|
|
|
|
|
|
|
invalid_creation_ctx= TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (load_collation(event_mem_root,
|
|
|
|
event_tbl->field[ET_FIELD_DB_COLLATION],
|
|
|
|
NULL,
|
|
|
|
&db_cl))
|
|
|
|
{
|
|
|
|
sql_print_warning("Event '%s'.'%s': invalid value "
|
|
|
|
"in column mysql.event.db_collation.",
|
|
|
|
(const char *) db_name,
|
|
|
|
(const char *) event_name);
|
|
|
|
|
|
|
|
invalid_creation_ctx= TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
If we failed to resolve the database collation, load the default one
|
|
|
|
from the disk.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!db_cl)
|
|
|
|
db_cl= get_default_db_collation(thd, db_name);
|
|
|
|
|
|
|
|
/* Create the context. */
|
|
|
|
|
|
|
|
*ctx= new Event_creation_ctx(client_cs, connection_cl, db_cl);
|
|
|
|
|
|
|
|
return invalid_creation_ctx;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2007-01-29 18:46:29 +01:00
|
|
|
/*
|
|
|
|
Initiliazes dbname and name of an Event_queue_element_for_exec
|
|
|
|
object
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_queue_element_for_exec::init()
|
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
FALSE OK
|
|
|
|
TRUE Error (OOM)
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool
|
|
|
|
Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n)
|
|
|
|
{
|
|
|
|
if (!(dbname.str= my_strndup(db.str, dbname.length= db.length, MYF(MY_WME))))
|
|
|
|
return TRUE;
|
|
|
|
if (!(name.str= my_strndup(n.str, name.length= n.length, MYF(MY_WME))))
|
|
|
|
{
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
2007-05-10 11:59:39 +02:00
|
|
|
my_free((uchar*) dbname.str, MYF(0));
|
2007-01-29 18:46:29 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Destructor
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_queue_element_for_exec::~Event_queue_element_for_exec()
|
|
|
|
*/
|
|
|
|
|
|
|
|
Event_queue_element_for_exec::~Event_queue_element_for_exec()
|
|
|
|
{
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
2007-05-10 11:59:39 +02:00
|
|
|
my_free((uchar*) dbname.str, MYF(0));
|
|
|
|
my_free((uchar*) name.str, MYF(0));
|
2007-01-29 18:46:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
/*
|
2006-07-03 11:20:08 +02:00
|
|
|
Returns a new instance
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
|
|
|
|
SYNOPSIS
|
2006-07-03 11:20:08 +02:00
|
|
|
Event_parse_data::new_instance()
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
|
2006-07-03 11:20:08 +02:00
|
|
|
RETURN VALUE
|
|
|
|
Address or NULL in case of error
|
2007-03-23 16:14:03 +01:00
|
|
|
|
2006-07-03 11:20:08 +02:00
|
|
|
NOTE
|
|
|
|
Created on THD's mem_root
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
*/
|
|
|
|
|
WL#3337 (Events new infrasctructure)
Second cut of separating parsing phase from execution phase
Separate Event_timed from parsing phase and introducing Event_parse_data.
sql/event_data_objects.cc:
second cut,
copy Event_timed::init_body() to Event_parse_data::init_body()
Init the body during parsing, everything else keep as a pointer to
Item or some other pointer to use for later initialization.
sql/event_data_objects.h:
get the identifier as sp_name*, later will initialize our structures
sql/events.cc:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/events.h:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
BitKeeper/etc/ignore:
Added libmysql/viosocket.o.6WmSJk libmysqld/event_data_objects.cc libmysqld/event_db_repository.cc libmysqld/event_queue.cc server-tools/instance-manager/net_serv.cc to the ignore list
sql/share/errmsg.txt:
remove this message, not used and needed for now
sql/sql_lex.h:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/sql_parse.cc:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/sql_yacc.yy:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
2006-06-27 10:53:26 +02:00
|
|
|
Event_parse_data *
|
|
|
|
Event_parse_data::new_instance(THD *thd)
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
{
|
WL#3337 (Events new infrasctructure)
Second cut of separating parsing phase from execution phase
Separate Event_timed from parsing phase and introducing Event_parse_data.
sql/event_data_objects.cc:
second cut,
copy Event_timed::init_body() to Event_parse_data::init_body()
Init the body during parsing, everything else keep as a pointer to
Item or some other pointer to use for later initialization.
sql/event_data_objects.h:
get the identifier as sp_name*, later will initialize our structures
sql/events.cc:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/events.h:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
BitKeeper/etc/ignore:
Added libmysql/viosocket.o.6WmSJk libmysqld/event_data_objects.cc libmysqld/event_db_repository.cc libmysqld/event_queue.cc server-tools/instance-manager/net_serv.cc to the ignore list
sql/share/errmsg.txt:
remove this message, not used and needed for now
sql/sql_lex.h:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/sql_parse.cc:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/sql_yacc.yy:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
2006-06-27 10:53:26 +02:00
|
|
|
return new (thd->mem_root) Event_parse_data;
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
}
|
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
|
|
|
|
/*
|
2006-07-03 11:20:08 +02:00
|
|
|
Constructor
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
SYNOPSIS
|
2006-07-03 11:20:08 +02:00
|
|
|
Event_parse_data::Event_parse_data()
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
WL#3337 (Events new infrasctructure)
Second cut of separating parsing phase from execution phase
Separate Event_timed from parsing phase and introducing Event_parse_data.
sql/event_data_objects.cc:
second cut,
copy Event_timed::init_body() to Event_parse_data::init_body()
Init the body during parsing, everything else keep as a pointer to
Item or some other pointer to use for later initialization.
sql/event_data_objects.h:
get the identifier as sp_name*, later will initialize our structures
sql/events.cc:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/events.h:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
BitKeeper/etc/ignore:
Added libmysql/viosocket.o.6WmSJk libmysqld/event_data_objects.cc libmysqld/event_db_repository.cc libmysqld/event_queue.cc server-tools/instance-manager/net_serv.cc to the ignore list
sql/share/errmsg.txt:
remove this message, not used and needed for now
sql/sql_lex.h:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/sql_parse.cc:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
sql/sql_yacc.yy:
for easy transition add temporarily parse_data, later Event_timed *et will be removed.
Do slow transition because Event_timed is so tightly integrated that a front-attack
by removing things from this class was unsuccessful. Do things step by step by eliminating
dependencies. Hence, the code could be checked with the current test suite too
(early testing)
2006-06-27 10:53:26 +02:00
|
|
|
Event_parse_data::Event_parse_data()
|
2007-04-05 18:47:22 +02:00
|
|
|
:on_completion(Event_basic::ON_COMPLETION_DROP),
|
|
|
|
status(Event_basic::ENABLED),
|
|
|
|
do_not_create(FALSE),
|
2007-06-14 16:49:17 +02:00
|
|
|
body_changed(FALSE),
|
|
|
|
item_starts(NULL), item_ends(NULL), item_execute_at(NULL),
|
|
|
|
starts_null(TRUE), ends_null(TRUE), execute_at_null(TRUE),
|
|
|
|
item_expression(NULL), expression(0)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_ENTER("Event_parse_data::Event_parse_data");
|
2005-12-05 11:45:04 +01:00
|
|
|
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
/* Actually in the parser STARTS is always set */
|
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
|
|
|
starts= ends= execute_at= 0;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
comment.str= NULL;
|
|
|
|
comment.length= 0;
|
2006-02-20 23:52:22 +01:00
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-02-15 19:08:44 +01:00
|
|
|
Set a name of the event
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
SYNOPSIS
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Event_parse_data::init_name()
|
2006-02-15 19:08:44 +01:00
|
|
|
thd THD
|
|
|
|
spn the name extracted in the parser
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Event_parse_data::init_name(THD *thd, sp_name *spn)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
DBUG_ENTER("Event_parse_data::init_name");
|
2005-12-05 11:45:04 +01:00
|
|
|
|
|
|
|
/* We have to copy strings to get them into the right memroot */
|
2006-07-07 01:07:45 +02:00
|
|
|
dbname.length= spn->m_db.length;
|
2006-07-10 23:54:46 +02:00
|
|
|
dbname.str= thd->strmake(spn->m_db.str, spn->m_db.length);
|
2006-07-07 01:07:45 +02:00
|
|
|
name.length= spn->m_name.length;
|
2006-07-10 23:54:46 +02:00
|
|
|
name.str= thd->strmake(spn->m_name.str, spn->m_name.length);
|
2006-07-07 01:07:45 +02:00
|
|
|
|
|
|
|
if (spn->m_qname.length == 0)
|
|
|
|
spn->init_qname(thd);
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
This function is called on CREATE EVENT or ALTER EVENT. When either
|
|
|
|
ENDS or AT is in the past, we are trying to create an event that
|
|
|
|
will never be executed. If it has ON COMPLETION NOT PRESERVE
|
|
|
|
(default), then it would normally be dropped already, so on CREATE
|
|
|
|
EVENT we give a warning, and do not create anyting. On ALTER EVENT
|
|
|
|
we give a error, and do not change the event.
|
|
|
|
|
|
|
|
If the event has ON COMPLETION PRESERVE, then we see if the event is
|
|
|
|
created or altered to the ENABLED (default) state. If so, then we
|
|
|
|
give a warning, and change the state to DISABLED.
|
|
|
|
|
|
|
|
Otherwise it is a valid event in ON COMPLETION PRESERVE DISABLE
|
|
|
|
state.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc)
|
|
|
|
{
|
|
|
|
if (ltime_utc >= (my_time_t) thd->query_start())
|
|
|
|
return;
|
|
|
|
|
2007-04-05 18:47:22 +02:00
|
|
|
if (on_completion == Event_basic::ON_COMPLETION_DROP)
|
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
|
|
|
{
|
|
|
|
switch (thd->lex->sql_command) {
|
|
|
|
case SQLCOM_CREATE_EVENT:
|
|
|
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
|
|
|
ER_EVENT_CANNOT_CREATE_IN_THE_PAST,
|
|
|
|
ER(ER_EVENT_CANNOT_CREATE_IN_THE_PAST));
|
|
|
|
break;
|
|
|
|
case SQLCOM_ALTER_EVENT:
|
|
|
|
my_error(ER_EVENT_CANNOT_ALTER_IN_THE_PAST, MYF(0));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DBUG_ASSERT(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
do_not_create= TRUE;
|
|
|
|
}
|
2007-04-05 18:47:22 +02:00
|
|
|
else if (status == Event_basic::ENABLED)
|
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
|
|
|
{
|
2007-04-05 18:47:22 +02:00
|
|
|
status= Event_basic::DISABLED;
|
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
|
|
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
|
|
|
ER_EVENT_EXEC_TIME_IN_THE_PAST,
|
|
|
|
ER(ER_EVENT_EXEC_TIME_IN_THE_PAST));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
/*
|
2006-07-11 18:28:15 +02:00
|
|
|
Sets time for execution for one-time event.
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
SYNOPSIS
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Event_parse_data::init_execute_at()
|
2006-07-11 18:28:15 +02:00
|
|
|
thd Thread
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
RETURN VALUE
|
2006-07-11 18:28:15 +02:00
|
|
|
0 OK
|
|
|
|
ER_WRONG_VALUE Wrong value for execute at (reported)
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_parse_data::init_execute_at(THD *thd)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
|
|
|
my_bool not_used;
|
2007-03-23 21:08:31 +01:00
|
|
|
MYSQL_TIME ltime;
|
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
|
|
|
my_time_t ltime_utc;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
DBUG_ENTER("Event_parse_data::init_execute_at");
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
if (!item_execute_at)
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
|
|
|
|
if (item_execute_at->fix_fields(thd, &item_execute_at))
|
|
|
|
goto wrong_value;
|
2007-03-23 16:14:03 +01:00
|
|
|
|
2006-02-28 11:43:10 +01:00
|
|
|
/* no starts and/or ends in case of execute_at */
|
|
|
|
DBUG_PRINT("info", ("starts_null && ends_null should be 1 is %d",
|
2006-02-28 14:43:49 +01:00
|
|
|
(starts_null && ends_null)));
|
2006-02-28 11:43:10 +01:00
|
|
|
DBUG_ASSERT(starts_null && ends_null);
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
if ((not_used= item_execute_at->get_date(<ime, TIME_NO_ZERO_DATE)))
|
|
|
|
goto wrong_value;
|
2006-01-26 21:21:21 +01:00
|
|
|
|
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
|
|
|
ltime_utc= TIME_to_timestamp(thd,<ime,¬_used);
|
|
|
|
if (!ltime_utc)
|
2006-03-03 01:39:11 +01:00
|
|
|
{
|
|
|
|
DBUG_PRINT("error", ("Execute AT after year 2037"));
|
2006-07-10 13:44:43 +02:00
|
|
|
goto wrong_value;
|
2006-03-03 01:39:11 +01:00
|
|
|
}
|
2005-12-05 11:45:04 +01:00
|
|
|
|
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
|
|
|
check_if_in_the_past(thd, ltime_utc);
|
|
|
|
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= FALSE;
|
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
|
|
|
execute_at= ltime_utc;
|
2005-12-05 11:45:04 +01:00
|
|
|
DBUG_RETURN(0);
|
2006-07-10 13:44:43 +02:00
|
|
|
|
|
|
|
wrong_value:
|
|
|
|
report_bad_value("AT", item_execute_at);
|
|
|
|
DBUG_RETURN(ER_WRONG_VALUE);
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-07-11 18:28:15 +02:00
|
|
|
Sets time for execution of multi-time event.s
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
SYNOPSIS
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Event_parse_data::init_interval()
|
2006-07-11 18:28:15 +02:00
|
|
|
thd Thread
|
2005-12-05 11:45:04 +01:00
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
RETURN VALUE
|
2006-07-11 18:28:15 +02:00
|
|
|
0 OK
|
|
|
|
EVEX_BAD_PARAMS Interval is not positive or MICROSECOND (reported)
|
|
|
|
ER_WRONG_VALUE Wrong value for interval (reported)
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_parse_data::init_interval(THD *thd)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-01-18 20:41:22 +01:00
|
|
|
String value;
|
2006-05-29 13:12:34 +02:00
|
|
|
INTERVAL interval_tmp;
|
2006-02-15 19:08:44 +01:00
|
|
|
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
DBUG_ENTER("Event_parse_data::init_interval");
|
2006-07-10 13:44:43 +02:00
|
|
|
if (!item_expression)
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
|
|
|
|
switch (interval) {
|
|
|
|
case INTERVAL_MINUTE_MICROSECOND:
|
|
|
|
case INTERVAL_HOUR_MICROSECOND:
|
|
|
|
case INTERVAL_DAY_MICROSECOND:
|
|
|
|
case INTERVAL_SECOND_MICROSECOND:
|
|
|
|
case INTERVAL_MICROSECOND:
|
|
|
|
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "MICROSECOND");
|
|
|
|
DBUG_RETURN(EVEX_BAD_PARAMS);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
if (item_expression->fix_fields(thd, &item_expression))
|
|
|
|
goto wrong_value;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-01-18 20:41:22 +01:00
|
|
|
value.alloc(MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN);
|
2006-07-10 13:44:43 +02:00
|
|
|
if (get_interval_value(item_expression, interval, &value, &interval_tmp))
|
|
|
|
goto wrong_value;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-01-18 20:41:22 +01:00
|
|
|
expression= 0;
|
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
switch (interval) {
|
2006-01-18 20:41:22 +01:00
|
|
|
case INTERVAL_YEAR:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.year;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_QUARTER:
|
|
|
|
case INTERVAL_MONTH:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.month;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_WEEK:
|
|
|
|
case INTERVAL_DAY:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.day;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_HOUR:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.hour;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_MINUTE:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.minute;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_SECOND:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.second;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
2006-02-15 19:08:44 +01:00
|
|
|
case INTERVAL_YEAR_MONTH: // Allow YEAR-MONTH YYYYYMM
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.year* 12 + interval_tmp.month;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_DAY_HOUR:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.day* 24 + interval_tmp.hour;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_DAY_MINUTE:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= (interval_tmp.day* 24 + interval_tmp.hour) * 60 +
|
|
|
|
interval_tmp.minute;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
2006-02-28 14:43:49 +01:00
|
|
|
case INTERVAL_HOUR_SECOND: /* day is anyway 0 */
|
2006-01-18 20:41:22 +01:00
|
|
|
case INTERVAL_DAY_SECOND:
|
|
|
|
/* DAY_SECOND having problems because of leap seconds? */
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= ((interval_tmp.day* 24 + interval_tmp.hour) * 60 +
|
|
|
|
interval_tmp.minute)*60
|
|
|
|
+ interval_tmp.second;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_HOUR_MINUTE:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.hour * 60 + interval_tmp.minute;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_MINUTE_SECOND:
|
2006-05-29 13:12:34 +02:00
|
|
|
expression= interval_tmp.minute * 60 + interval_tmp.second;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
2006-06-08 23:07:11 +02:00
|
|
|
case INTERVAL_LAST:
|
|
|
|
DBUG_ASSERT(0);
|
2006-07-10 13:44:43 +02:00
|
|
|
default:
|
|
|
|
;/* these are the microsec stuff */
|
2006-01-18 20:41:22 +01:00
|
|
|
}
|
2007-05-25 14:46:22 +02:00
|
|
|
if (interval_tmp.neg || expression == 0 ||
|
|
|
|
expression > EVEX_MAX_INTERVAL_VALUE)
|
2006-07-10 13:44:43 +02:00
|
|
|
{
|
|
|
|
my_error(ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG, MYF(0));
|
2006-01-18 20:41:22 +01:00
|
|
|
DBUG_RETURN(EVEX_BAD_PARAMS);
|
2006-07-10 13:44:43 +02:00
|
|
|
}
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
DBUG_RETURN(0);
|
2006-07-10 13:44:43 +02:00
|
|
|
|
|
|
|
wrong_value:
|
2006-09-25 16:49:25 +02:00
|
|
|
report_bad_value("INTERVAL", item_expression);
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_RETURN(ER_WRONG_VALUE);
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-07-11 18:28:15 +02:00
|
|
|
Sets STARTS.
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
SYNOPSIS
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Event_parse_data::init_starts()
|
|
|
|
expr how much?
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
NOTES
|
|
|
|
Note that activation time is not execution time.
|
|
|
|
EVERY 5 MINUTE STARTS "2004-12-12 10:00:00" means that
|
|
|
|
the event will be executed every 5 minutes but this will
|
|
|
|
start at the date shown above. Expressions are possible :
|
|
|
|
DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tommorow at
|
|
|
|
same time.
|
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
RETURN VALUE
|
2006-07-11 18:28:15 +02:00
|
|
|
0 OK
|
|
|
|
ER_WRONG_VALUE Starts before now
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_parse_data::init_starts(THD *thd)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
|
|
|
my_bool not_used;
|
2007-03-23 21:08:31 +01:00
|
|
|
MYSQL_TIME ltime;
|
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
|
|
|
my_time_t ltime_utc;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
DBUG_ENTER("Event_parse_data::init_starts");
|
2006-07-10 13:44:43 +02:00
|
|
|
if (!item_starts)
|
|
|
|
DBUG_RETURN(0);
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
if (item_starts->fix_fields(thd, &item_starts))
|
|
|
|
goto wrong_value;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
if ((not_used= item_starts->get_date(<ime, TIME_NO_ZERO_DATE)))
|
|
|
|
goto wrong_value;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
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
|
|
|
ltime_utc= TIME_to_timestamp(thd, <ime, ¬_used);
|
|
|
|
if (!ltime_utc)
|
2006-07-10 13:44:43 +02:00
|
|
|
goto wrong_value;
|
2006-01-26 21:21:21 +01:00
|
|
|
|
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
|
|
|
DBUG_PRINT("info",("now: %ld starts: %ld",
|
|
|
|
(long) thd->query_start(), (long) ltime_utc));
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-28 11:43:10 +01:00
|
|
|
starts_null= FALSE;
|
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
|
|
|
starts= ltime_utc;
|
2005-12-05 11:45:04 +01:00
|
|
|
DBUG_RETURN(0);
|
2006-07-10 13:44:43 +02:00
|
|
|
|
|
|
|
wrong_value:
|
|
|
|
report_bad_value("STARTS", item_starts);
|
|
|
|
DBUG_RETURN(ER_WRONG_VALUE);
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-07-11 18:28:15 +02:00
|
|
|
Sets ENDS (deactivation time).
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
SYNOPSIS
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Event_parse_data::init_ends()
|
2006-02-15 19:08:44 +01:00
|
|
|
thd THD
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
Note that activation time is not execution time.
|
|
|
|
EVERY 5 MINUTE ENDS "2004-12-12 10:00:00" means that
|
|
|
|
the event will be executed every 5 minutes but this will
|
|
|
|
end at the date shown above. Expressions are possible :
|
|
|
|
DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tommorow at
|
|
|
|
same time.
|
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
RETURN VALUE
|
2006-02-15 19:08:44 +01:00
|
|
|
0 OK
|
2006-07-10 13:44:43 +02:00
|
|
|
EVEX_BAD_PARAMS Error (reported)
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
int
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_parse_data::init_ends(THD *thd)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
|
|
|
my_bool not_used;
|
2007-03-23 21:08:31 +01:00
|
|
|
MYSQL_TIME ltime;
|
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
|
|
|
my_time_t ltime_utc;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
DBUG_ENTER("Event_parse_data::init_ends");
|
2006-07-10 13:44:43 +02:00
|
|
|
if (!item_ends)
|
|
|
|
DBUG_RETURN(0);
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
if (item_ends->fix_fields(thd, &item_ends))
|
|
|
|
goto error_bad_params;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-28 11:43:10 +01:00
|
|
|
DBUG_PRINT("info", ("convert to TIME"));
|
2006-07-10 13:44:43 +02:00
|
|
|
if ((not_used= item_ends->get_date(<ime, TIME_NO_ZERO_DATE)))
|
|
|
|
goto error_bad_params;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
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
|
|
|
ltime_utc= TIME_to_timestamp(thd, <ime, ¬_used);
|
|
|
|
if (!ltime_utc)
|
2006-07-10 13:44:43 +02:00
|
|
|
goto error_bad_params;
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2006-02-28 11:43:10 +01:00
|
|
|
/* Check whether ends is after starts */
|
|
|
|
DBUG_PRINT("info", ("ENDS after STARTS?"));
|
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
|
|
|
if (!starts_null && starts >= ltime_utc)
|
2006-07-10 13:44:43 +02:00
|
|
|
goto error_bad_params;
|
2006-02-28 11:43:10 +01:00
|
|
|
|
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
|
|
|
check_if_in_the_past(thd, ltime_utc);
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-28 11:43:10 +01:00
|
|
|
ends_null= FALSE;
|
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
|
|
|
ends= ltime_utc;
|
2005-12-05 11:45:04 +01:00
|
|
|
DBUG_RETURN(0);
|
2006-07-10 13:44:43 +02:00
|
|
|
|
|
|
|
error_bad_params:
|
|
|
|
my_error(ER_EVENT_ENDS_BEFORE_STARTS, MYF(0));
|
|
|
|
DBUG_RETURN(EVEX_BAD_PARAMS);
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-07-10 13:44:43 +02:00
|
|
|
Prints an error message about invalid value. Internally used
|
|
|
|
during input data verification
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
SYNOPSIS
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_parse_data::report_bad_value()
|
|
|
|
item_name The name of the parameter
|
|
|
|
bad_item The parameter
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_parse_data::report_bad_value(const char *item_name, Item *bad_item)
|
|
|
|
{
|
|
|
|
char buff[120];
|
|
|
|
String str(buff,(uint32) sizeof(buff), system_charset_info);
|
|
|
|
String *str2= bad_item->fixed? bad_item->val_str(&str):NULL;
|
|
|
|
my_error(ER_WRONG_VALUE, MYF(0), item_name, str2? str2->c_ptr_safe():"NULL");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-07-11 18:28:15 +02:00
|
|
|
Checks for validity the data gathered during the parsing phase.
|
2006-07-10 13:44:43 +02:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_parse_data::check_parse_data()
|
|
|
|
thd Thread
|
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
FALSE OK
|
|
|
|
TRUE Error (reported)
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool
|
|
|
|
Event_parse_data::check_parse_data(THD *thd)
|
|
|
|
{
|
|
|
|
bool ret;
|
|
|
|
DBUG_ENTER("Event_parse_data::check_parse_data");
|
2006-11-27 00:47:38 +01:00
|
|
|
DBUG_PRINT("info", ("execute_at: 0x%lx expr=0x%lx starts=0x%lx ends=0x%lx",
|
|
|
|
(long) item_execute_at, (long) item_expression,
|
|
|
|
(long) item_starts, (long) item_ends));
|
2006-07-10 13:44:43 +02:00
|
|
|
|
|
|
|
init_name(thd, identifier);
|
|
|
|
|
|
|
|
init_definer(thd);
|
|
|
|
|
|
|
|
ret= init_execute_at(thd) || init_interval(thd) || init_starts(thd) ||
|
|
|
|
init_ends(thd);
|
2007-04-05 18:47:22 +02:00
|
|
|
check_originator_id(thd);
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_RETURN(ret);
|
|
|
|
}
|
|
|
|
|
2006-07-11 18:28:15 +02:00
|
|
|
|
2006-07-13 16:24:55 +02:00
|
|
|
/*
|
|
|
|
Inits definer (definer_user and definer_host) during parsing.
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_parse_data::init_definer()
|
|
|
|
thd Thread
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
Event_parse_data::init_definer(THD *thd)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("Event_parse_data::init_definer");
|
|
|
|
|
2007-02-02 18:43:33 +01:00
|
|
|
DBUG_ASSERT(thd->lex->definer);
|
|
|
|
|
|
|
|
const char *definer_user= thd->lex->definer->user.str;
|
|
|
|
const char *definer_host= thd->lex->definer->host.str;
|
|
|
|
int definer_user_len= thd->lex->definer->user.length;
|
|
|
|
int definer_host_len= thd->lex->definer->host.length;
|
2006-07-13 16:24:55 +02:00
|
|
|
|
2007-02-02 18:43:33 +01:00
|
|
|
DBUG_PRINT("info",("init definer_user thd->mem_root: 0x%lx "
|
|
|
|
"definer_user: 0x%lx", (long) thd->mem_root,
|
|
|
|
(long) definer_user));
|
2006-07-13 16:24:55 +02:00
|
|
|
|
|
|
|
/* + 1 for @ */
|
|
|
|
DBUG_PRINT("info",("init definer as whole"));
|
|
|
|
definer.length= definer_user_len + definer_host_len + 1;
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
2007-05-10 11:59:39 +02:00
|
|
|
definer.str= (char*) thd->alloc(definer.length + 1);
|
2006-07-13 16:24:55 +02:00
|
|
|
|
|
|
|
DBUG_PRINT("info",("copy the user"));
|
2007-02-02 18:43:33 +01:00
|
|
|
memcpy(definer.str, definer_user, definer_user_len);
|
2006-07-13 16:24:55 +02:00
|
|
|
definer.str[definer_user_len]= '@';
|
|
|
|
|
|
|
|
DBUG_PRINT("info",("copy the host"));
|
2007-02-02 18:43:33 +01:00
|
|
|
memcpy(definer.str + definer_user_len + 1, definer_host, definer_host_len);
|
2006-07-13 16:24:55 +02:00
|
|
|
definer.str[definer.length]= '\0';
|
|
|
|
DBUG_PRINT("info",("definer [%s] initted", definer.str));
|
|
|
|
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-05 18:47:22 +02:00
|
|
|
/**
|
|
|
|
Set the originator id of the event to the server_id if executing on
|
|
|
|
the master or set to the server_id of the master if executing on
|
|
|
|
the slave. If executing on slave, also set status to SLAVESIDE_DISABLED.
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_parse_data::check_originator_id()
|
|
|
|
*/
|
|
|
|
void Event_parse_data::check_originator_id(THD *thd)
|
|
|
|
{
|
|
|
|
/* Disable replicated events on slave. */
|
|
|
|
if ((thd->system_thread == SYSTEM_THREAD_SLAVE_SQL) ||
|
|
|
|
(thd->system_thread == SYSTEM_THREAD_SLAVE_IO))
|
|
|
|
{
|
|
|
|
DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED."));
|
|
|
|
if ((status == Event_basic::ENABLED) ||
|
|
|
|
(status == Event_basic::DISABLED))
|
|
|
|
status = Event_basic::SLAVESIDE_DISABLED;
|
|
|
|
originator = thd->server_id;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
originator = server_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
/*
|
|
|
|
Constructor
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_basic::Event_basic()
|
|
|
|
*/
|
|
|
|
|
|
|
|
Event_basic::Event_basic()
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_ENTER("Event_basic::Event_basic");
|
|
|
|
/* init memory root */
|
|
|
|
init_alloc_root(&mem_root, 256, 512);
|
|
|
|
dbname.str= name.str= NULL;
|
|
|
|
dbname.length= name.length= 0;
|
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
|
|
|
time_zone= NULL;
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
2006-07-10 23:54:46 +02:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Destructor
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
SYNOPSIS
|
|
|
|
Event_basic::Event_basic()
|
|
|
|
*/
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_basic::~Event_basic()
|
|
|
|
{
|
|
|
|
DBUG_ENTER("Event_basic::~Event_basic");
|
|
|
|
free_root(&mem_root, MYF(0));
|
2005-12-05 11:45:04 +01:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-07-10 13:44:43 +02:00
|
|
|
Short function to load a char column into a LEX_STRING
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
SYNOPSIS
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_basic::load_string_field()
|
|
|
|
field_name The field( enum_events_table_field is not actually used
|
|
|
|
because it's unknown in event_data_objects.h)
|
|
|
|
fields The Field array
|
|
|
|
field_value The value
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool
|
|
|
|
Event_basic::load_string_fields(Field **fields, ...)
|
|
|
|
{
|
|
|
|
bool ret= FALSE;
|
|
|
|
va_list args;
|
|
|
|
enum enum_events_table_field field_name;
|
|
|
|
LEX_STRING *field_value;
|
|
|
|
|
|
|
|
DBUG_ENTER("Event_basic::load_string_fields");
|
2006-07-10 23:54:46 +02:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
va_start(args, fields);
|
|
|
|
field_name= (enum enum_events_table_field) va_arg(args, int);
|
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
|
|
|
while (field_name < ET_FIELD_COUNT)
|
2006-07-10 13:44:43 +02:00
|
|
|
{
|
|
|
|
field_value= va_arg(args, LEX_STRING *);
|
|
|
|
if ((field_value->str= get_field(&mem_root, fields[field_name])) == NullS)
|
|
|
|
{
|
|
|
|
ret= TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2007-03-23 16:14:03 +01:00
|
|
|
field_value->length= strlen(field_value->str);
|
2006-07-10 13:44:43 +02:00
|
|
|
|
|
|
|
field_name= (enum enum_events_table_field) va_arg(args, int);
|
|
|
|
}
|
|
|
|
va_end(args);
|
2006-07-10 23:54:46 +02:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_RETURN(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
bool
|
|
|
|
Event_basic::load_time_zone(THD *thd, const LEX_STRING tz_name)
|
|
|
|
{
|
|
|
|
String str(tz_name.str, &my_charset_latin1);
|
|
|
|
time_zone= my_tz_find(thd, &str);
|
|
|
|
|
|
|
|
return (time_zone == NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
/*
|
|
|
|
Constructor
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_queue_element::Event_queue_element()
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_queue_element::Event_queue_element():
|
|
|
|
status_changed(FALSE), last_executed_changed(FALSE),
|
|
|
|
on_completion(ON_COMPLETION_DROP), status(ENABLED),
|
2006-07-17 16:52:45 +02:00
|
|
|
expression(0), dropped(FALSE), execution_count(0)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_ENTER("Event_queue_element::Event_queue_element");
|
2005-12-05 11:45:04 +01:00
|
|
|
|
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
|
|
|
starts= ends= execute_at= last_executed= 0;
|
2006-07-10 13:44:43 +02:00
|
|
|
starts_null= ends_null= execute_at_null= TRUE;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
2006-02-15 19:08:44 +01:00
|
|
|
|
fix for bug#16642 (Events: No INFORMATION_SCHEMA.EVENTS table)
post-review change - use pointer instead of copy on the stack.
WL#1034 (Internal CRON)
This patch adds INFORMATION_SCHEMA.EVENTS table with the following format:
EVENT_CATALOG - MYSQL_TYPE_STRING (Always NULL)
EVENT_SCHEMA - MYSQL_TYPE_STRING (the database)
EVENT_NAME - MYSQL_TYPE_STRING (the name)
DEFINER - MYSQL_TYPE_STRING (user@host)
EVENT_BODY - MYSQL_TYPE_STRING (the body from mysql.event)
EVENT_TYPE - MYSQL_TYPE_STRING ("ONE TIME" | "RECURRING")
EXECUTE_AT - MYSQL_TYPE_TIMESTAMP (set for "ONE TIME" otherwise NULL)
INTERVAL_VALUE - MYSQL_TYPE_LONG (set for RECURRING otherwise NULL)
INTERVAL_FIELD - MYSQL_TYPE_STRING (set for RECURRING otherwise NULL)
SQL_MODE - MYSQL_TYPE_STRING (for now NULL)
STARTS - MYSQL_TYPE_TIMESTAMP (starts from mysql.event)
ENDS - MYSQL_TYPE_TIMESTAMP (ends from mysql.event)
STATUS - MYSQL_TYPE_STRING (ENABLED | DISABLED)
ON_COMPLETION - MYSQL_TYPE_STRING (NOT PRESERVE | PRESERVE)
CREATED - MYSQL_TYPE_TIMESTAMP
LAST_ALTERED - MYSQL_TYPE_TIMESTAMP
LAST_EXECUTED - MYSQL_TYPE_TIMESTAMP
EVENT_COMMENT - MYSQL_TYPE_STRING
SQL_MODE is NULL for now, because the value is still not stored in mysql.event .
Support will be added as a fix for another bug.
This patch also adds SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
1. SHOW EVENTS shows always only the events on the same user,
because the PK of mysql.event is (definer, db, name) several
users may have event with the same name -> no information disclosure.
2. SHOW FULL EVENTS - shows the events (in the current db as SHOW EVENTS)
of all users. The user has to have PROCESS privilege, if not then
SHOW FULL EVENTS behave like SHOW EVENTS.
3. If [FROM db] is specified then this db is considered.
4. Event names can be filtered with LIKE pattern.
SHOW EVENTS returns table with the following columns, which are subset of
the data which is returned by SELECT * FROM I_S.EVENTS
Db
Name
Definer
Type
Execute at
Interval value
Interval field
Starts
Ends
Status
mysql-test/lib/init_db.sql:
change the PK - (definer, db, name)
quicker searches when SHOW EVENTS;
allow also different users to have events with the same name ->
no information disclosure
mysql-test/r/events.result:
result of new tests
mysql-test/r/information_schema.result:
result of new tests
mysql-test/r/information_schema_db.result:
result of new tests
mysql-test/r/system_mysql_db.result:
result of new tests
mysql-test/t/events.test:
new tests for information_schema.events
scripts/mysql_create_system_tables.sh:
change the PK of mysql.event to (definer, db, name)
scripts/mysql_fix_privilege_tables.sql:
change the PK of mysql.event to (definer, db, name)
sql/event.cc:
pass around the definer of the event because of the new PK
which is (definer, db, name). It's needed for index searching.
sql/event.h:
- make enum evex_table_field again public so it can be used
in sql_show.cc
- make created and modified ulonglong, because they should be such
- make public evex_open_event_table so it can be used in sql_show.cc
sql/event_executor.cc:
- cosmetics
sql/event_priv.h:
- moved enum evex_table_field and evex_open_event_table()
to event.h (made them therefore public)
sql/event_timed.cc:
- in event_timed::init_definer() always fill this.definer with
the concatenated value of definer_user@definer_host. Makes
later the work easier.
- pass around the definer wherever is needed for searching
(new prototype of evex_db_find_evex_aux)
sql/mysqld.cc:
- add counter for SHOW EVENTS
sql/sql_lex.h:
- register SHOW EVENTS as command
sql/sql_parse.cc:
- handle SCH_EVENTS (I_S.EVENTS like SCH_TRIGGERS)
- make additional check in case of SHOW EVENTS (check for EVENT on
the current database. if it is null check_access() gives appropriate
message back.
sql/sql_show.cc:
- add INFORMATION_SCHEMA.EVENTS and SHOW EVENTS
- I_S.EVENTS.SQL_MODE is NULL for now -> not implemented. Trudy
asked to be added so bug #16642 can be completely closed. There
is another bug report which will fix the lack of storage of
SQL_MODE during event creation.
sql/sql_yacc.yy:
- always call event_timed::init_definer() when CREATE/ALTER/DROP
EVENT but not when just compiling the body of the event because
in this case this operation is not needed, it takes memory and
CPU time and at the end the result is not used. event_timed::definer
is used only on SQLCOM_CREATE/ALTER/DROP_EVENT execution not on
statement compilation.
- add SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
in case of FULL and the user has PROCESS privilege then he will see
also others' events in the current database, otherwise the output
is the same as of SHOW EVENTS. Because the events are per DB only
the events from the current database are shown. pattern is applied
against event name. FROM db is self explanatory.
sql/table.h:
add SCH_EVENTS as part of INFORMATION_SCHEMA
2006-01-30 13:15:23 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
/*
|
|
|
|
Destructor
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
SYNOPSIS
|
|
|
|
Event_queue_element::Event_queue_element()
|
|
|
|
*/
|
|
|
|
Event_queue_element::~Event_queue_element()
|
|
|
|
{
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Constructor
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
SYNOPSIS
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Event_timed::Event_timed()
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_timed::Event_timed():
|
|
|
|
created(0), modified(0), sql_mode(0)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_ENTER("Event_timed::Event_timed");
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
init();
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_VOID_RETURN;
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Destructor
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
SYNOPSIS
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
Event_timed::~Event_timed()
|
|
|
|
*/
|
|
|
|
|
|
|
|
Event_timed::~Event_timed()
|
2007-03-23 16:14:03 +01:00
|
|
|
{
|
2006-07-10 13:44:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Constructor
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_job_data::Event_job_data()
|
|
|
|
*/
|
|
|
|
|
2006-08-17 14:22:59 +02:00
|
|
|
Event_job_data::Event_job_data()
|
2007-04-13 22:35:56 +02:00
|
|
|
:sql_mode(0)
|
2006-07-10 23:54:46 +02:00
|
|
|
{
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Init all member variables
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
Event_timed::init()
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
Event_timed::init()
|
|
|
|
{
|
|
|
|
DBUG_ENTER("Event_timed::init");
|
|
|
|
|
2006-07-11 18:28:15 +02:00
|
|
|
definer_user.str= definer_host.str= body.str= comment.str= NULL;
|
|
|
|
definer_user.length= definer_host.length= body.length= comment.length= 0;
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
|
|
|
|
sql_mode= 0;
|
|
|
|
|
|
|
|
DBUG_VOID_RETURN;
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
/**
|
|
|
|
Load an event's body from a row from mysql.event.
|
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
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
@details This method is silent on errors and should behave like that.
|
|
|
|
Callers should handle throwing of error messages. The reason is that the
|
|
|
|
class should not know about how to deal with communication.
|
|
|
|
|
|
|
|
@return Operation status
|
|
|
|
@retval FALSE OK
|
|
|
|
@retval TRUE Error
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
bool
|
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
|
|
|
Event_job_data::load_from_row(THD *thd, TABLE *table)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
|
|
|
char *ptr;
|
|
|
|
uint len;
|
2007-06-14 16:49:17 +02:00
|
|
|
LEX_STRING tz_name;
|
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_ENTER("Event_job_data::load_from_row");
|
2005-12-05 11:45:04 +01:00
|
|
|
|
|
|
|
if (!table)
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2005-12-05 11:45:04 +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
|
|
|
if (table->s->fields < ET_FIELD_COUNT)
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2005-12-05 11:45:04 +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
|
|
|
if (load_string_fields(table->field,
|
|
|
|
ET_FIELD_DB, &dbname,
|
|
|
|
ET_FIELD_NAME, &name,
|
|
|
|
ET_FIELD_BODY, &body,
|
|
|
|
ET_FIELD_DEFINER, &definer,
|
|
|
|
ET_FIELD_TIME_ZONE, &tz_name,
|
|
|
|
ET_FIELD_COUNT))
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
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
|
|
|
|
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
|
|
|
if (load_time_zone(thd, tz_name))
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2006-02-15 19:08:44 +01:00
|
|
|
|
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
|
|
|
Event_creation_ctx::load_from_db(thd, &mem_root, dbname.str, name.str, table,
|
|
|
|
&creation_ctx);
|
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
ptr= strchr(definer.str, '@');
|
|
|
|
|
|
|
|
if (! ptr)
|
|
|
|
ptr= definer.str;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
len= ptr - definer.str;
|
|
|
|
definer_user.str= strmake_root(&mem_root, definer.str, len);
|
|
|
|
definer_user.length= len;
|
|
|
|
len= definer.length - len - 1;
|
|
|
|
/* 1:because of @ */
|
2006-07-10 23:54:46 +02:00
|
|
|
definer_host.str= strmake_root(&mem_root, ptr + 1, len);
|
2006-07-10 13:44:43 +02:00
|
|
|
definer_host.length= len;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
sql_mode= (ulong) table->field[ET_FIELD_SQL_MODE]->val_int();
|
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(FALSE);
|
2006-07-10 13:44:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
/**
|
|
|
|
Load an event's body from a row from mysql.event.
|
2006-07-10 13:44:43 +02:00
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
@details This method is silent on errors and should behave like that.
|
|
|
|
Callers should handle throwing of error messages. The reason is that the
|
|
|
|
class should not know about how to deal with communication.
|
2006-07-10 13:44:43 +02:00
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
@return Operation status
|
|
|
|
@retval FALSE OK
|
|
|
|
@retval TRUE Error
|
2006-07-10 13:44:43 +02:00
|
|
|
*/
|
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
bool
|
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
|
|
|
Event_queue_element::load_from_row(THD *thd, TABLE *table)
|
2006-07-10 13:44:43 +02:00
|
|
|
{
|
|
|
|
char *ptr;
|
2007-03-23 21:08:31 +01:00
|
|
|
MYSQL_TIME time;
|
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
|
|
|
LEX_STRING tz_name;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_ENTER("Event_queue_element::load_from_row");
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
if (!table)
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2005-12-05 11:45:04 +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
|
|
|
if (table->s->fields < ET_FIELD_COUNT)
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
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
|
|
|
|
|
|
|
if (load_string_fields(table->field,
|
|
|
|
ET_FIELD_DB, &dbname,
|
|
|
|
ET_FIELD_NAME, &name,
|
|
|
|
ET_FIELD_DEFINER, &definer,
|
|
|
|
ET_FIELD_TIME_ZONE, &tz_name,
|
|
|
|
ET_FIELD_COUNT))
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2005-12-05 11:45:04 +01:00
|
|
|
|
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
|
|
|
if (load_time_zone(thd, tz_name))
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
starts_null= table->field[ET_FIELD_STARTS]->is_null();
|
2007-07-25 09:43:49 +02:00
|
|
|
my_bool not_used= FALSE;
|
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
|
|
|
if (!starts_null)
|
|
|
|
{
|
|
|
|
table->field[ET_FIELD_STARTS]->get_date(&time, TIME_NO_ZERO_DATE);
|
2007-07-25 09:43:49 +02:00
|
|
|
starts= my_tz_OFFSET0->TIME_to_gmt_sec(&time,¬_used);
|
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
|
|
|
}
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
ends_null= table->field[ET_FIELD_ENDS]->is_null();
|
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
|
|
|
if (!ends_null)
|
|
|
|
{
|
|
|
|
table->field[ET_FIELD_ENDS]->get_date(&time, TIME_NO_ZERO_DATE);
|
2007-07-25 09:43:49 +02:00
|
|
|
ends= my_tz_OFFSET0->TIME_to_gmt_sec(&time,¬_used);
|
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
|
|
|
}
|
2006-07-10 23:54:46 +02:00
|
|
|
|
2006-06-28 01:28:03 +02:00
|
|
|
if (!table->field[ET_FIELD_INTERVAL_EXPR]->is_null())
|
2006-07-10 13:44:43 +02:00
|
|
|
expression= table->field[ET_FIELD_INTERVAL_EXPR]->val_int();
|
2006-02-28 11:43:10 +01:00
|
|
|
else
|
2006-07-10 13:44:43 +02:00
|
|
|
expression= 0;
|
2005-12-05 11:45:04 +01:00
|
|
|
/*
|
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
|
|
|
If neigher STARTS and ENDS is set, then both fields are empty.
|
2006-07-11 18:28:15 +02:00
|
|
|
Hence, if ET_FIELD_EXECUTE_AT is empty there is an error.
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
2006-07-10 13:44:43 +02:00
|
|
|
execute_at_null= table->field[ET_FIELD_EXECUTE_AT]->is_null();
|
|
|
|
DBUG_ASSERT(!(starts_null && ends_null && !expression && execute_at_null));
|
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
|
|
|
if (!expression && !execute_at_null)
|
|
|
|
{
|
|
|
|
if (table->field[ET_FIELD_EXECUTE_AT]->get_date(&time,
|
|
|
|
TIME_NO_ZERO_DATE))
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2007-07-25 09:43:49 +02:00
|
|
|
execute_at= my_tz_OFFSET0->TIME_to_gmt_sec(&time,¬_used);
|
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
|
|
|
}
|
2005-12-05 11:45:04 +01:00
|
|
|
|
|
|
|
/*
|
2006-10-10 17:59:46 +02:00
|
|
|
We load the interval type from disk as string and then map it to
|
|
|
|
an integer. This decouples the values of enum interval_type
|
|
|
|
and values actually stored on disk. Therefore the type can be
|
|
|
|
reordered without risking incompatibilities of data between versions.
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
2006-06-28 01:28:03 +02:00
|
|
|
if (!table->field[ET_FIELD_TRANSIENT_INTERVAL]->is_null())
|
2006-10-10 17:59:46 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char buff[MAX_FIELD_WIDTH];
|
|
|
|
String str(buff, sizeof(buff), &my_charset_bin);
|
|
|
|
LEX_STRING tmp;
|
|
|
|
|
|
|
|
table->field[ET_FIELD_TRANSIENT_INTERVAL]->val_str(&str);
|
|
|
|
if (!(tmp.length= str.length()))
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2006-10-10 17:59:46 +02:00
|
|
|
|
|
|
|
tmp.str= str.c_ptr_safe();
|
|
|
|
|
|
|
|
i= find_string_in_array(interval_type_to_name, &tmp, system_charset_info);
|
|
|
|
if (i < 0)
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2006-10-10 17:59:46 +02:00
|
|
|
interval= (interval_type) i;
|
|
|
|
}
|
2005-12-05 11:45:04 +01:00
|
|
|
|
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
|
|
|
if (!table->field[ET_FIELD_LAST_EXECUTED]->is_null())
|
|
|
|
{
|
|
|
|
table->field[ET_FIELD_LAST_EXECUTED]->get_date(&time,
|
|
|
|
TIME_NO_ZERO_DATE);
|
2007-07-25 09:43:49 +02:00
|
|
|
last_executed= my_tz_OFFSET0->TIME_to_gmt_sec(&time,¬_used);
|
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
|
|
|
}
|
2006-07-10 13:44:43 +02:00
|
|
|
last_executed_changed= FALSE;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-04 18:44:35 +02:00
|
|
|
if ((ptr= get_field(&mem_root, table->field[ET_FIELD_STATUS])) == NullS)
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2006-04-07 09:08:58 +02:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_PRINT("load_from_row", ("Event [%s] is [%s]", name.str, ptr));
|
2007-04-05 18:47:22 +02:00
|
|
|
|
|
|
|
/* Set event status (ENABLED | SLAVESIDE_DISABLED | DISABLED) */
|
|
|
|
switch (ptr[0])
|
|
|
|
{
|
|
|
|
case 'E' :
|
|
|
|
status = Event_queue_element::ENABLED;
|
|
|
|
break;
|
|
|
|
case 'S' :
|
|
|
|
status = Event_queue_element::SLAVESIDE_DISABLED;
|
|
|
|
break;
|
|
|
|
case 'D' :
|
2007-04-05 23:53:15 +02:00
|
|
|
default:
|
2007-04-05 18:47:22 +02:00
|
|
|
status = Event_queue_element::DISABLED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ((ptr= get_field(&mem_root, table->field[ET_FIELD_ORIGINATOR])) == NullS)
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2007-04-05 18:47:22 +02:00
|
|
|
originator = table->field[ET_FIELD_ORIGINATOR]->val_int();
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-02-28 14:43:49 +01:00
|
|
|
/* ToDo : Andrey . Find a way not to allocate ptr on event_mem_root */
|
2006-07-04 18:44:35 +02:00
|
|
|
if ((ptr= get_field(&mem_root,
|
2006-07-10 13:44:43 +02:00
|
|
|
table->field[ET_FIELD_ON_COMPLETION])) == NullS)
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
on_completion= (ptr[0]=='D'? Event_queue_element::ON_COMPLETION_DROP:
|
|
|
|
Event_queue_element::ON_COMPLETION_PRESERVE);
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(FALSE);
|
2006-07-10 13:44:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
/**
|
|
|
|
Load an event's body from a row from mysql.event.
|
2006-07-10 13:44:43 +02:00
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
@details This method is silent on errors and should behave like that.
|
|
|
|
Callers should handle throwing of error messages. The reason is that the
|
|
|
|
class should not know about how to deal with communication.
|
2006-07-10 13:44:43 +02:00
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
@return Operation status
|
|
|
|
@retval FALSE OK
|
|
|
|
@retval TRUE Error
|
2006-07-10 13:44:43 +02:00
|
|
|
*/
|
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
bool
|
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
|
|
|
Event_timed::load_from_row(THD *thd, TABLE *table)
|
2006-07-10 13:44:43 +02:00
|
|
|
{
|
|
|
|
char *ptr;
|
|
|
|
uint len;
|
|
|
|
|
|
|
|
DBUG_ENTER("Event_timed::load_from_row");
|
|
|
|
|
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
|
|
|
if (Event_queue_element::load_from_row(thd, table))
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2005-12-05 11:45:04 +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
|
|
|
if (load_string_fields(table->field,
|
|
|
|
ET_FIELD_BODY, &body,
|
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
|
|
|
ET_FIELD_BODY_UTF8, &body_utf8,
|
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
|
|
|
ET_FIELD_COUNT))
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
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
|
|
|
|
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
|
|
|
if (Event_creation_ctx::load_from_db(thd, &mem_root, dbname.str, name.str,
|
|
|
|
table, &creation_ctx))
|
|
|
|
{
|
|
|
|
push_warning_printf(thd,
|
|
|
|
MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
|
|
ER_EVENT_INVALID_CREATION_CTX,
|
|
|
|
ER(ER_EVENT_INVALID_CREATION_CTX),
|
|
|
|
(const char *) dbname.str,
|
|
|
|
(const char *) name.str);
|
|
|
|
}
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
ptr= strchr(definer.str, '@');
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
if (! ptr)
|
|
|
|
ptr= definer.str;
|
|
|
|
|
|
|
|
len= ptr - definer.str;
|
|
|
|
definer_user.str= strmake_root(&mem_root, definer.str, len);
|
|
|
|
definer_user.length= len;
|
|
|
|
len= definer.length - len - 1;
|
|
|
|
/* 1:because of @ */
|
|
|
|
definer_host.str= strmake_root(&mem_root, ptr + 1, len);
|
|
|
|
definer_host.length= len;
|
|
|
|
|
|
|
|
created= table->field[ET_FIELD_CREATED]->val_int();
|
|
|
|
modified= table->field[ET_FIELD_MODIFIED]->val_int();
|
|
|
|
|
|
|
|
comment.str= get_field(&mem_root, table->field[ET_FIELD_COMMENT]);
|
|
|
|
if (comment.str != NullS)
|
|
|
|
comment.length= strlen(comment.str);
|
2005-12-05 11:45:04 +01:00
|
|
|
else
|
2006-07-10 13:44:43 +02:00
|
|
|
comment.length= 0;
|
2006-02-20 23:52:22 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
sql_mode= (ulong) table->field[ET_FIELD_SQL_MODE]->val_int();
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2007-06-14 16:49:17 +02:00
|
|
|
DBUG_RETURN(FALSE);
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-08 00:17:05 +01:00
|
|
|
/*
|
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
|
|
|
add_interval() adds a specified interval to time 'ltime' in time
|
|
|
|
zone 'time_zone', and returns the result converted to the number of
|
|
|
|
seconds since epoch (aka Unix time; in UTC time zone). Zero result
|
|
|
|
means an error.
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
my_time_t
|
2007-03-23 21:08:31 +01:00
|
|
|
add_interval(MYSQL_TIME *ltime, const Time_zone *time_zone,
|
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
|
|
|
interval_type scale, INTERVAL interval)
|
|
|
|
{
|
|
|
|
if (date_add_interval(ltime, scale, interval))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
my_bool not_used;
|
|
|
|
return time_zone->TIME_to_gmt_sec(ltime, ¬_used);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Computes the sum of a timestamp plus interval.
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
SYNOPSIS
|
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
|
|
|
get_next_time()
|
|
|
|
time_zone event time zone
|
2006-02-15 19:08:44 +01:00
|
|
|
next the sum
|
|
|
|
start add interval_value to this time
|
2006-04-07 09:08:58 +02:00
|
|
|
time_now current time
|
2006-02-15 19:08:44 +01:00
|
|
|
i_value quantity of time type interval to add
|
|
|
|
i_type type of interval to add (SECOND, MINUTE, HOUR, WEEK ...)
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
RETURN VALUE
|
2006-04-07 09:08:58 +02:00
|
|
|
0 OK
|
|
|
|
1 Error
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
1) If the interval is conversible to SECOND, like MINUTE, HOUR, DAY, WEEK.
|
|
|
|
Then we use TIMEDIFF()'s implementation as underlying and number of
|
|
|
|
seconds as resolution for computation.
|
|
|
|
2) In all other cases - MONTH, QUARTER, YEAR we use MONTH as resolution
|
|
|
|
and PERIOD_DIFF()'s implementation
|
2006-01-18 20:41:22 +01:00
|
|
|
*/
|
2005-12-08 00:17:05 +01:00
|
|
|
|
2006-01-18 20:41:22 +01:00
|
|
|
static
|
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
|
|
|
bool get_next_time(const Time_zone *time_zone, my_time_t *next,
|
|
|
|
my_time_t start, my_time_t time_now,
|
2006-04-07 09:08:58 +02:00
|
|
|
int i_value, interval_type i_type)
|
2006-01-18 20:41:22 +01:00
|
|
|
{
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_ENTER("get_next_time");
|
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
|
|
|
DBUG_PRINT("enter", ("start: %lu now: %lu", (long) start, (long) time_now));
|
2006-02-15 19:08:44 +01:00
|
|
|
|
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
|
|
|
DBUG_ASSERT(start <= time_now);
|
|
|
|
|
|
|
|
longlong months=0, seconds=0;
|
2006-01-18 20:41:22 +01:00
|
|
|
|
|
|
|
switch (i_type) {
|
|
|
|
case INTERVAL_YEAR:
|
2006-04-07 09:08:58 +02:00
|
|
|
months= i_value*12;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_QUARTER:
|
2006-04-07 09:08:58 +02:00
|
|
|
/* Has already been converted to months */
|
2006-01-18 20:41:22 +01:00
|
|
|
case INTERVAL_YEAR_MONTH:
|
|
|
|
case INTERVAL_MONTH:
|
2006-04-07 09:08:58 +02:00
|
|
|
months= i_value;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_WEEK:
|
2006-04-07 09:08:58 +02:00
|
|
|
/* WEEK has already been converted to days */
|
2006-01-18 20:41:22 +01:00
|
|
|
case INTERVAL_DAY:
|
2006-04-07 09:08:58 +02:00
|
|
|
seconds= i_value*24*3600;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_DAY_HOUR:
|
|
|
|
case INTERVAL_HOUR:
|
2006-04-07 09:08:58 +02:00
|
|
|
seconds= i_value*3600;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_DAY_MINUTE:
|
|
|
|
case INTERVAL_HOUR_MINUTE:
|
|
|
|
case INTERVAL_MINUTE:
|
2006-04-07 09:08:58 +02:00
|
|
|
seconds= i_value*60;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_DAY_SECOND:
|
|
|
|
case INTERVAL_HOUR_SECOND:
|
|
|
|
case INTERVAL_MINUTE_SECOND:
|
|
|
|
case INTERVAL_SECOND:
|
2006-04-07 09:08:58 +02:00
|
|
|
seconds= i_value;
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
|
|
|
case INTERVAL_DAY_MICROSECOND:
|
|
|
|
case INTERVAL_HOUR_MICROSECOND:
|
|
|
|
case INTERVAL_MINUTE_MICROSECOND:
|
|
|
|
case INTERVAL_SECOND_MICROSECOND:
|
|
|
|
case INTERVAL_MICROSECOND:
|
2006-04-07 09:08:58 +02:00
|
|
|
/*
|
|
|
|
We should return an error here so SHOW EVENTS/ SELECT FROM I_S.EVENTS
|
|
|
|
would give an error then.
|
|
|
|
*/
|
|
|
|
DBUG_RETURN(1);
|
2006-01-18 20:41:22 +01:00
|
|
|
break;
|
2006-06-08 23:07:11 +02:00
|
|
|
case INTERVAL_LAST:
|
|
|
|
DBUG_ASSERT(0);
|
2006-01-18 20:41:22 +01:00
|
|
|
}
|
2006-11-27 00:47:38 +01:00
|
|
|
DBUG_PRINT("info", ("seconds: %ld months: %ld", (long) seconds, (long) months));
|
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
|
|
|
|
2007-03-23 21:08:31 +01:00
|
|
|
MYSQL_TIME local_start;
|
|
|
|
MYSQL_TIME local_now;
|
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
|
|
|
|
|
|
|
/* Convert times from UTC to local. */
|
|
|
|
{
|
|
|
|
time_zone->gmt_sec_to_TIME(&local_start, start);
|
|
|
|
time_zone->gmt_sec_to_TIME(&local_now, time_now);
|
|
|
|
}
|
|
|
|
|
|
|
|
INTERVAL interval;
|
|
|
|
bzero(&interval, sizeof(interval));
|
|
|
|
my_time_t next_time= 0;
|
|
|
|
|
2006-04-07 09:08:58 +02:00
|
|
|
if (seconds)
|
|
|
|
{
|
|
|
|
longlong seconds_diff;
|
|
|
|
long microsec_diff;
|
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
|
|
|
bool negative= calc_time_diff(&local_now, &local_start, 1,
|
|
|
|
&seconds_diff, µsec_diff);
|
|
|
|
if (!negative)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
The formula below returns the interval that, when added to
|
|
|
|
local_start, will always give the time in the future.
|
|
|
|
*/
|
|
|
|
interval.second= seconds_diff - seconds_diff % seconds + seconds;
|
|
|
|
next_time= add_interval(&local_start, time_zone,
|
|
|
|
INTERVAL_SECOND, interval);
|
|
|
|
if (next_time == 0)
|
|
|
|
goto done;
|
|
|
|
}
|
2006-08-17 14:22:59 +02:00
|
|
|
|
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
|
|
|
if (next_time <= time_now)
|
2006-04-07 09:08:58 +02:00
|
|
|
{
|
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
|
|
|
/*
|
|
|
|
If 'negative' is true above, then 'next_time == 0', and
|
|
|
|
'next_time <= time_now' is also true. If negative is false,
|
|
|
|
then next_time was set, but perhaps to the value that is less
|
|
|
|
then time_now. See below for elaboration.
|
|
|
|
*/
|
|
|
|
DBUG_ASSERT(negative || next_time > 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
If local_now < local_start, i.e. STARTS time is in the future
|
|
|
|
according to the local time (it always in the past according
|
|
|
|
to UTC---this is a prerequisite of this function), then
|
|
|
|
STARTS is almost always in the past according to the local
|
|
|
|
time too. However, in the time zone that has backward
|
|
|
|
Daylight Saving Time shift, the following may happen: suppose
|
|
|
|
we have a backward DST shift at certain date after 2:59:59,
|
|
|
|
i.e. local time goes 1:59:59, 2:00:00, ... , 2:59:59, (shift
|
|
|
|
here) 2:00:00 (again), ... , 2:59:59 (again), 3:00:00, ... .
|
|
|
|
Now suppose the time has passed the first 2:59:59, has been
|
|
|
|
shifted backward, and now is (the second) 2:20:00. The user
|
|
|
|
does CREATE EVENT with STARTS 'current-date 2:40:00'. Local
|
|
|
|
time 2:40:00 from create statement is treated by time
|
|
|
|
functions as the first such time, so according to UTC it comes
|
|
|
|
before the second 2:20:00. But according to local time it is
|
|
|
|
obviously in the future, so we end up in this branch.
|
|
|
|
|
|
|
|
Since we are in the second pass through 2:00:00--2:59:59, and
|
|
|
|
any local time form this interval is treated by system
|
|
|
|
functions as the time from the first pass, we have to find the
|
|
|
|
time for the next execution that is past the DST-affected
|
|
|
|
interval (past the second 2:59:59 for our example,
|
|
|
|
i.e. starting from 3:00:00). We do this in the loop until the
|
|
|
|
local time is mapped onto future UTC time. 'start' time is in
|
|
|
|
the past, so we may use 'do { } while' here, and add the first
|
|
|
|
interval right away.
|
|
|
|
|
|
|
|
Alternatively, it could be that local_now >= local_start. Now
|
|
|
|
for the example above imagine we do CREATE EVENT with STARTS
|
|
|
|
'current-date 2:10:00'. Local start 2:10 is in the past (now
|
|
|
|
is local 2:20), so we add an interval, and get next execution
|
|
|
|
time, say, 2:40. It is in the future according to local time,
|
|
|
|
but, again, since we are in the second pass through
|
|
|
|
2:00:00--2:59:59, 2:40 will be converted into UTC time in the
|
|
|
|
past. So we will end up in this branch again, and may add
|
|
|
|
intervals in a 'do { } while' loop.
|
|
|
|
|
|
|
|
Note that for any given event we may end up here only if event
|
|
|
|
next execution time will map to the time interval that is
|
|
|
|
passed twice, and only if the server was started during the
|
|
|
|
second pass, or the event is being created during the second
|
|
|
|
pass. After that, we never will get here (unless we again
|
|
|
|
start the server during the second pass). In other words,
|
|
|
|
such a condition is extremely rare.
|
|
|
|
*/
|
|
|
|
interval.second= seconds;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
next_time= add_interval(&local_start, time_zone,
|
|
|
|
INTERVAL_SECOND, interval);
|
|
|
|
if (next_time == 0)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
while (next_time <= time_now);
|
2006-04-07 09:08:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
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
|
|
|
long diff_months= (long) (local_now.year - local_start.year)*12 +
|
|
|
|
(local_now.month - local_start.month);
|
2006-04-07 09:08:58 +02:00
|
|
|
/*
|
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
|
|
|
Unlike for seconds above, the formula below returns the interval
|
|
|
|
that, when added to the local_start, will give the time in the
|
|
|
|
past, or somewhere in the current month. We are interested in
|
|
|
|
the latter case, to see if this time has already passed, or is
|
|
|
|
yet to come this month.
|
|
|
|
|
|
|
|
Note that the time is guaranteed to be in the past unless
|
|
|
|
(diff_months % months == 0), but no good optimization is
|
|
|
|
possible here, because (diff_months % months == 0) is what will
|
|
|
|
happen most of the time, as get_next_time() will be called right
|
|
|
|
after the execution of the event. We could pass last_executed
|
|
|
|
time to this function, and see if the execution has already
|
|
|
|
happened this month, but for that we will have to convert
|
|
|
|
last_executed from seconds since epoch to local broken-down
|
|
|
|
time, and this will greatly reduce the effect of the
|
|
|
|
optimization. So instead we keep the code simple and clean.
|
2006-04-07 09:08:58 +02:00
|
|
|
*/
|
2007-03-16 18:50:37 +01:00
|
|
|
interval.month= (ulong) (diff_months - diff_months % months);
|
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
|
|
|
next_time= add_interval(&local_start, time_zone,
|
|
|
|
INTERVAL_MONTH, interval);
|
|
|
|
if (next_time == 0)
|
2006-04-07 09:08:58 +02:00
|
|
|
goto done;
|
2006-07-10 13:44:43 +02:00
|
|
|
|
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
|
|
|
if (next_time <= time_now)
|
|
|
|
{
|
2007-03-16 18:50:37 +01:00
|
|
|
interval.month= (ulong) months;
|
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
|
|
|
next_time= add_interval(&local_start, time_zone,
|
|
|
|
INTERVAL_MONTH, interval);
|
|
|
|
if (next_time == 0)
|
2006-04-07 09:08:58 +02:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
2006-01-18 20:41:22 +01:00
|
|
|
|
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
|
|
|
DBUG_ASSERT(time_now < next_time);
|
|
|
|
|
|
|
|
*next= next_time;
|
|
|
|
|
2006-04-07 09:08:58 +02:00
|
|
|
done:
|
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
|
|
|
DBUG_PRINT("info", ("next_time: %ld", (long) next_time));
|
|
|
|
DBUG_RETURN(next_time == 0);
|
2006-01-18 20:41:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-02-15 19:08:44 +01:00
|
|
|
Computes next execution time.
|
|
|
|
|
|
|
|
SYNOPSIS
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_queue_element::compute_next_execution_time()
|
2006-02-15 19:08:44 +01:00
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
RETURN VALUE
|
|
|
|
FALSE OK
|
|
|
|
TRUE Error
|
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
NOTES
|
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
|
|
|
The time is set in execute_at, if no more executions the latter is
|
|
|
|
set to 0.
|
2005-12-08 00:17:05 +01:00
|
|
|
*/
|
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
bool
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_queue_element::compute_next_execution_time()
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
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
|
|
|
my_time_t time_now;
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_ENTER("Event_queue_element::compute_next_execution_time");
|
2006-11-27 00:47:38 +01:00
|
|
|
DBUG_PRINT("enter", ("starts: %lu ends: %lu last_executed: %lu this: 0x%lx",
|
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
|
|
|
(long) starts, (long) ends, (long) last_executed,
|
2006-11-27 00:47:38 +01:00
|
|
|
(long) this));
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2007-04-05 18:47:22 +02:00
|
|
|
if (status != Event_queue_element::ENABLED)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
|
|
|
DBUG_PRINT("compute_next_execution_time",
|
2006-11-27 00:47:38 +01:00
|
|
|
("Event %s is DISABLED", name.str));
|
2005-12-05 11:45:04 +01:00
|
|
|
goto ret;
|
|
|
|
}
|
2006-02-15 19:08:44 +01:00
|
|
|
/* If one-time, no need to do computation */
|
2005-12-08 00:17:05 +01:00
|
|
|
if (!expression)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-02-15 19:08:44 +01:00
|
|
|
/* Let's check whether it was executed */
|
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
|
|
|
if (last_executed)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-02-28 11:43:10 +01:00
|
|
|
DBUG_PRINT("info",("One-time event %s.%s of was already executed",
|
2006-11-27 00:47:38 +01:00
|
|
|
dbname.str, name.str));
|
2006-07-10 13:44:43 +02:00
|
|
|
dropped= (on_completion == Event_queue_element::ON_COMPLETION_DROP);
|
2006-11-27 00:47:38 +01:00
|
|
|
DBUG_PRINT("info",("One-time event will be dropped: %d.", dropped));
|
2006-02-28 11:43:10 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
status= Event_queue_element::DISABLED;
|
|
|
|
status_changed= TRUE;
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
goto ret;
|
|
|
|
}
|
2006-05-29 10:39:45 +02:00
|
|
|
|
2007-03-21 18:32:15 +01:00
|
|
|
time_now= (my_time_t) current_thd->query_start();
|
fix for bug#16642 (Events: No INFORMATION_SCHEMA.EVENTS table)
post-review change - use pointer instead of copy on the stack.
WL#1034 (Internal CRON)
This patch adds INFORMATION_SCHEMA.EVENTS table with the following format:
EVENT_CATALOG - MYSQL_TYPE_STRING (Always NULL)
EVENT_SCHEMA - MYSQL_TYPE_STRING (the database)
EVENT_NAME - MYSQL_TYPE_STRING (the name)
DEFINER - MYSQL_TYPE_STRING (user@host)
EVENT_BODY - MYSQL_TYPE_STRING (the body from mysql.event)
EVENT_TYPE - MYSQL_TYPE_STRING ("ONE TIME" | "RECURRING")
EXECUTE_AT - MYSQL_TYPE_TIMESTAMP (set for "ONE TIME" otherwise NULL)
INTERVAL_VALUE - MYSQL_TYPE_LONG (set for RECURRING otherwise NULL)
INTERVAL_FIELD - MYSQL_TYPE_STRING (set for RECURRING otherwise NULL)
SQL_MODE - MYSQL_TYPE_STRING (for now NULL)
STARTS - MYSQL_TYPE_TIMESTAMP (starts from mysql.event)
ENDS - MYSQL_TYPE_TIMESTAMP (ends from mysql.event)
STATUS - MYSQL_TYPE_STRING (ENABLED | DISABLED)
ON_COMPLETION - MYSQL_TYPE_STRING (NOT PRESERVE | PRESERVE)
CREATED - MYSQL_TYPE_TIMESTAMP
LAST_ALTERED - MYSQL_TYPE_TIMESTAMP
LAST_EXECUTED - MYSQL_TYPE_TIMESTAMP
EVENT_COMMENT - MYSQL_TYPE_STRING
SQL_MODE is NULL for now, because the value is still not stored in mysql.event .
Support will be added as a fix for another bug.
This patch also adds SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
1. SHOW EVENTS shows always only the events on the same user,
because the PK of mysql.event is (definer, db, name) several
users may have event with the same name -> no information disclosure.
2. SHOW FULL EVENTS - shows the events (in the current db as SHOW EVENTS)
of all users. The user has to have PROCESS privilege, if not then
SHOW FULL EVENTS behave like SHOW EVENTS.
3. If [FROM db] is specified then this db is considered.
4. Event names can be filtered with LIKE pattern.
SHOW EVENTS returns table with the following columns, which are subset of
the data which is returned by SELECT * FROM I_S.EVENTS
Db
Name
Definer
Type
Execute at
Interval value
Interval field
Starts
Ends
Status
mysql-test/lib/init_db.sql:
change the PK - (definer, db, name)
quicker searches when SHOW EVENTS;
allow also different users to have events with the same name ->
no information disclosure
mysql-test/r/events.result:
result of new tests
mysql-test/r/information_schema.result:
result of new tests
mysql-test/r/information_schema_db.result:
result of new tests
mysql-test/r/system_mysql_db.result:
result of new tests
mysql-test/t/events.test:
new tests for information_schema.events
scripts/mysql_create_system_tables.sh:
change the PK of mysql.event to (definer, db, name)
scripts/mysql_fix_privilege_tables.sql:
change the PK of mysql.event to (definer, db, name)
sql/event.cc:
pass around the definer of the event because of the new PK
which is (definer, db, name). It's needed for index searching.
sql/event.h:
- make enum evex_table_field again public so it can be used
in sql_show.cc
- make created and modified ulonglong, because they should be such
- make public evex_open_event_table so it can be used in sql_show.cc
sql/event_executor.cc:
- cosmetics
sql/event_priv.h:
- moved enum evex_table_field and evex_open_event_table()
to event.h (made them therefore public)
sql/event_timed.cc:
- in event_timed::init_definer() always fill this.definer with
the concatenated value of definer_user@definer_host. Makes
later the work easier.
- pass around the definer wherever is needed for searching
(new prototype of evex_db_find_evex_aux)
sql/mysqld.cc:
- add counter for SHOW EVENTS
sql/sql_lex.h:
- register SHOW EVENTS as command
sql/sql_parse.cc:
- handle SCH_EVENTS (I_S.EVENTS like SCH_TRIGGERS)
- make additional check in case of SHOW EVENTS (check for EVENT on
the current database. if it is null check_access() gives appropriate
message back.
sql/sql_show.cc:
- add INFORMATION_SCHEMA.EVENTS and SHOW EVENTS
- I_S.EVENTS.SQL_MODE is NULL for now -> not implemented. Trudy
asked to be added so bug #16642 can be completely closed. There
is another bug report which will fix the lack of storage of
SQL_MODE during event creation.
sql/sql_yacc.yy:
- always call event_timed::init_definer() when CREATE/ALTER/DROP
EVENT but not when just compiling the body of the event because
in this case this operation is not needed, it takes memory and
CPU time and at the end the result is not used. event_timed::definer
is used only on SQLCOM_CREATE/ALTER/DROP_EVENT execution not on
statement compilation.
- add SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
in case of FULL and the user has PROCESS privilege then he will see
also others' events in the current database, otherwise the output
is the same as of SHOW EVENTS. Because the events are per DB only
the events from the current database are shown. pattern is applied
against event name. FROM db is self explanatory.
sql/table.h:
add SCH_EVENTS as part of INFORMATION_SCHEMA
2006-01-30 13:15:23 +01:00
|
|
|
|
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
|
|
|
DBUG_PRINT("info",("NOW: [%lu]", (ulong) time_now));
|
fix for bug#16642 (Events: No INFORMATION_SCHEMA.EVENTS table)
post-review change - use pointer instead of copy on the stack.
WL#1034 (Internal CRON)
This patch adds INFORMATION_SCHEMA.EVENTS table with the following format:
EVENT_CATALOG - MYSQL_TYPE_STRING (Always NULL)
EVENT_SCHEMA - MYSQL_TYPE_STRING (the database)
EVENT_NAME - MYSQL_TYPE_STRING (the name)
DEFINER - MYSQL_TYPE_STRING (user@host)
EVENT_BODY - MYSQL_TYPE_STRING (the body from mysql.event)
EVENT_TYPE - MYSQL_TYPE_STRING ("ONE TIME" | "RECURRING")
EXECUTE_AT - MYSQL_TYPE_TIMESTAMP (set for "ONE TIME" otherwise NULL)
INTERVAL_VALUE - MYSQL_TYPE_LONG (set for RECURRING otherwise NULL)
INTERVAL_FIELD - MYSQL_TYPE_STRING (set for RECURRING otherwise NULL)
SQL_MODE - MYSQL_TYPE_STRING (for now NULL)
STARTS - MYSQL_TYPE_TIMESTAMP (starts from mysql.event)
ENDS - MYSQL_TYPE_TIMESTAMP (ends from mysql.event)
STATUS - MYSQL_TYPE_STRING (ENABLED | DISABLED)
ON_COMPLETION - MYSQL_TYPE_STRING (NOT PRESERVE | PRESERVE)
CREATED - MYSQL_TYPE_TIMESTAMP
LAST_ALTERED - MYSQL_TYPE_TIMESTAMP
LAST_EXECUTED - MYSQL_TYPE_TIMESTAMP
EVENT_COMMENT - MYSQL_TYPE_STRING
SQL_MODE is NULL for now, because the value is still not stored in mysql.event .
Support will be added as a fix for another bug.
This patch also adds SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
1. SHOW EVENTS shows always only the events on the same user,
because the PK of mysql.event is (definer, db, name) several
users may have event with the same name -> no information disclosure.
2. SHOW FULL EVENTS - shows the events (in the current db as SHOW EVENTS)
of all users. The user has to have PROCESS privilege, if not then
SHOW FULL EVENTS behave like SHOW EVENTS.
3. If [FROM db] is specified then this db is considered.
4. Event names can be filtered with LIKE pattern.
SHOW EVENTS returns table with the following columns, which are subset of
the data which is returned by SELECT * FROM I_S.EVENTS
Db
Name
Definer
Type
Execute at
Interval value
Interval field
Starts
Ends
Status
mysql-test/lib/init_db.sql:
change the PK - (definer, db, name)
quicker searches when SHOW EVENTS;
allow also different users to have events with the same name ->
no information disclosure
mysql-test/r/events.result:
result of new tests
mysql-test/r/information_schema.result:
result of new tests
mysql-test/r/information_schema_db.result:
result of new tests
mysql-test/r/system_mysql_db.result:
result of new tests
mysql-test/t/events.test:
new tests for information_schema.events
scripts/mysql_create_system_tables.sh:
change the PK of mysql.event to (definer, db, name)
scripts/mysql_fix_privilege_tables.sql:
change the PK of mysql.event to (definer, db, name)
sql/event.cc:
pass around the definer of the event because of the new PK
which is (definer, db, name). It's needed for index searching.
sql/event.h:
- make enum evex_table_field again public so it can be used
in sql_show.cc
- make created and modified ulonglong, because they should be such
- make public evex_open_event_table so it can be used in sql_show.cc
sql/event_executor.cc:
- cosmetics
sql/event_priv.h:
- moved enum evex_table_field and evex_open_event_table()
to event.h (made them therefore public)
sql/event_timed.cc:
- in event_timed::init_definer() always fill this.definer with
the concatenated value of definer_user@definer_host. Makes
later the work easier.
- pass around the definer wherever is needed for searching
(new prototype of evex_db_find_evex_aux)
sql/mysqld.cc:
- add counter for SHOW EVENTS
sql/sql_lex.h:
- register SHOW EVENTS as command
sql/sql_parse.cc:
- handle SCH_EVENTS (I_S.EVENTS like SCH_TRIGGERS)
- make additional check in case of SHOW EVENTS (check for EVENT on
the current database. if it is null check_access() gives appropriate
message back.
sql/sql_show.cc:
- add INFORMATION_SCHEMA.EVENTS and SHOW EVENTS
- I_S.EVENTS.SQL_MODE is NULL for now -> not implemented. Trudy
asked to be added so bug #16642 can be completely closed. There
is another bug report which will fix the lack of storage of
SQL_MODE during event creation.
sql/sql_yacc.yy:
- always call event_timed::init_definer() when CREATE/ALTER/DROP
EVENT but not when just compiling the body of the event because
in this case this operation is not needed, it takes memory and
CPU time and at the end the result is not used. event_timed::definer
is used only on SQLCOM_CREATE/ALTER/DROP_EVENT execution not on
statement compilation.
- add SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
in case of FULL and the user has PROCESS privilege then he will see
also others' events in the current database, otherwise the output
is the same as of SHOW EVENTS. Because the events are per DB only
the events from the current database are shown. pattern is applied
against event name. FROM db is self explanatory.
sql/table.h:
add SCH_EVENTS as part of INFORMATION_SCHEMA
2006-01-30 13:15:23 +01:00
|
|
|
|
2006-02-28 12:08:13 +01:00
|
|
|
/* if time_now is after ends don't execute anymore */
|
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
|
|
|
if (!ends_null && ends < time_now)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("NOW after ENDS, don't execute anymore"));
|
2006-02-15 19:08:44 +01:00
|
|
|
/* time_now is after ends. don't execute anymore */
|
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
|
|
|
execute_at= 0;
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= TRUE;
|
2006-07-10 13:44:43 +02:00
|
|
|
if (on_completion == Event_queue_element::ON_COMPLETION_DROP)
|
|
|
|
dropped= TRUE;
|
2006-11-27 00:47:38 +01:00
|
|
|
DBUG_PRINT("info", ("Dropped: %d", dropped));
|
2006-07-10 13:44:43 +02:00
|
|
|
status= Event_queue_element::DISABLED;
|
|
|
|
status_changed= TRUE;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
|
|
|
goto ret;
|
|
|
|
}
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Here time_now is before or equals ends if the latter is set.
|
|
|
|
Let's check whether time_now is before starts.
|
|
|
|
If so schedule for starts.
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
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
|
|
|
if (!starts_null && time_now <= starts)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
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
|
|
|
if (time_now == starts && starts == last_executed)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-02-15 19:08:44 +01:00
|
|
|
/*
|
2005-12-08 00:17:05 +01:00
|
|
|
do nothing or we will schedule for second time execution at starts.
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("STARTS is future, NOW <= STARTS,sched for STARTS"));
|
2005-12-08 00:17:05 +01:00
|
|
|
/*
|
|
|
|
starts is in the future
|
|
|
|
time_now before starts. Scheduling for starts
|
|
|
|
*/
|
|
|
|
execute_at= starts;
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= FALSE;
|
2005-12-05 11:45:04 +01:00
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
}
|
2006-02-28 14:43:49 +01:00
|
|
|
|
2006-02-28 11:43:10 +01:00
|
|
|
if (!starts_null && !ends_null)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-02-15 19:08:44 +01:00
|
|
|
/*
|
2005-12-08 00:17:05 +01:00
|
|
|
Both starts and m_ends are set and time_now is between them (incl.)
|
2007-03-23 21:08:31 +01:00
|
|
|
If last_executed is set then increase with m_expression. The new MYSQL_TIME is
|
2005-12-08 00:17:05 +01:00
|
|
|
after m_ends set execute_at to 0. And check for on_completion
|
2005-12-05 11:45:04 +01:00
|
|
|
If not set then schedule for now.
|
|
|
|
*/
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("Both STARTS & ENDS are set"));
|
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
|
|
|
if (!last_executed)
|
2006-02-28 11:43:10 +01:00
|
|
|
{
|
2006-04-18 21:21:43 +02:00
|
|
|
DBUG_PRINT("info", ("Not executed so far."));
|
2006-02-28 11:43:10 +01:00
|
|
|
}
|
2006-04-18 21:21:43 +02:00
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
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
|
|
|
my_time_t next_exec;
|
2006-02-15 19:08:44 +01:00
|
|
|
|
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
|
|
|
if (get_next_time(time_zone, &next_exec, starts, time_now,
|
2006-11-30 02:40:42 +01:00
|
|
|
(int) expression, interval))
|
2006-01-18 20:41:22 +01:00
|
|
|
goto err;
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
/* There was previous execution */
|
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
|
|
|
if (ends < next_exec)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
DBUG_PRINT("info", ("Next execution of %s after ENDS. Stop executing.",
|
|
|
|
name.str));
|
2006-02-15 19:08:44 +01:00
|
|
|
/* Next execution after ends. No more executions */
|
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
|
|
|
execute_at= 0;
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= TRUE;
|
2006-07-10 13:44:43 +02:00
|
|
|
if (on_completion == Event_queue_element::ON_COMPLETION_DROP)
|
|
|
|
dropped= TRUE;
|
|
|
|
status= Event_queue_element::DISABLED;
|
|
|
|
status_changed= TRUE;
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
else
|
2006-02-28 11:43:10 +01:00
|
|
|
{
|
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
|
|
|
DBUG_PRINT("info",("Next[%lu]", (ulong) next_exec));
|
2006-01-18 20:41:22 +01:00
|
|
|
execute_at= next_exec;
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= FALSE;
|
|
|
|
}
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
goto ret;
|
|
|
|
}
|
2006-08-17 14:22:59 +02:00
|
|
|
else if (starts_null && ends_null)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-04-18 21:21:43 +02:00
|
|
|
/* starts is always set, so this is a dead branch !! */
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("Neither STARTS nor ENDS are set"));
|
2006-02-15 19:08:44 +01:00
|
|
|
/*
|
|
|
|
Both starts and m_ends are not set, so we schedule for the next
|
|
|
|
based on last_executed.
|
|
|
|
*/
|
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
|
|
|
if (last_executed)
|
2006-01-18 20:41:22 +01:00
|
|
|
{
|
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
|
|
|
my_time_t next_exec;
|
|
|
|
if (get_next_time(time_zone, &next_exec, starts, time_now,
|
2006-11-30 02:40:42 +01:00
|
|
|
(int) expression, interval))
|
2006-01-18 20:41:22 +01:00
|
|
|
goto err;
|
2006-04-07 09:08:58 +02:00
|
|
|
execute_at= next_exec;
|
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
|
|
|
DBUG_PRINT("info",("Next[%lu]", (ulong) next_exec));
|
2006-01-18 20:41:22 +01:00
|
|
|
}
|
|
|
|
else
|
2006-02-15 19:08:44 +01:00
|
|
|
{
|
|
|
|
/* last_executed not set. Schedule the event for now */
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("Execute NOW"));
|
2005-12-08 00:17:05 +01:00
|
|
|
execute_at= time_now;
|
2006-02-15 19:08:44 +01:00
|
|
|
}
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= FALSE;
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-02-28 12:08:13 +01:00
|
|
|
/* either starts or m_ends is set */
|
2006-02-28 11:43:10 +01:00
|
|
|
if (!starts_null)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("STARTS is set"));
|
2005-12-05 11:45:04 +01:00
|
|
|
/*
|
2005-12-08 00:17:05 +01:00
|
|
|
- starts is set.
|
|
|
|
- starts is not in the future according to check made before
|
|
|
|
Hence schedule for starts + m_expression in case last_executed
|
|
|
|
is not set, otherwise to last_executed + m_expression
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
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
|
|
|
if (!last_executed)
|
2006-04-18 21:21:43 +02:00
|
|
|
{
|
|
|
|
DBUG_PRINT("info", ("Not executed so far."));
|
|
|
|
}
|
|
|
|
|
2006-01-18 20:41:22 +01:00
|
|
|
{
|
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
|
|
|
my_time_t next_exec;
|
|
|
|
if (get_next_time(time_zone, &next_exec, starts, time_now,
|
2006-11-30 02:40:42 +01:00
|
|
|
(int) expression, interval))
|
2006-01-18 20:41:22 +01:00
|
|
|
goto err;
|
2006-04-07 09:08:58 +02:00
|
|
|
execute_at= next_exec;
|
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
|
|
|
DBUG_PRINT("info",("Next[%lu]", (ulong) next_exec));
|
2006-01-18 20:41:22 +01:00
|
|
|
}
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= FALSE;
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-04-18 21:21:43 +02:00
|
|
|
/* this is a dead branch, because starts is always set !!! */
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("STARTS is not set. ENDS is set"));
|
2005-12-05 11:45:04 +01:00
|
|
|
/*
|
|
|
|
- m_ends is set
|
|
|
|
- m_ends is after time_now or is equal
|
2005-12-08 00:17:05 +01:00
|
|
|
Hence check for m_last_execute and increment with m_expression.
|
|
|
|
If last_executed is not set then schedule for now
|
2005-12-05 11:45:04 +01:00
|
|
|
*/
|
|
|
|
|
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
|
|
|
if (!last_executed)
|
2005-12-08 00:17:05 +01:00
|
|
|
execute_at= time_now;
|
2005-12-05 11:45:04 +01:00
|
|
|
else
|
|
|
|
{
|
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
|
|
|
my_time_t next_exec;
|
2006-01-18 20:41:22 +01:00
|
|
|
|
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
|
|
|
if (get_next_time(time_zone, &next_exec, starts, time_now,
|
2006-11-30 02:40:42 +01:00
|
|
|
(int) expression, interval))
|
2006-01-18 20:41:22 +01:00
|
|
|
goto err;
|
|
|
|
|
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
|
|
|
if (ends < next_exec)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("Next execution after ENDS. Stop executing."));
|
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
|
|
|
execute_at= 0;
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= TRUE;
|
2006-07-10 13:44:43 +02:00
|
|
|
status= Event_queue_element::DISABLED;
|
|
|
|
status_changed= TRUE;
|
|
|
|
if (on_completion == Event_queue_element::ON_COMPLETION_DROP)
|
|
|
|
dropped= TRUE;
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
else
|
2006-02-28 11:43:10 +01:00
|
|
|
{
|
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
|
|
|
DBUG_PRINT("info", ("Next[%lu]", (ulong) next_exec));
|
2006-01-18 20:41:22 +01:00
|
|
|
execute_at= next_exec;
|
2006-02-28 11:43:10 +01:00
|
|
|
execute_at_null= FALSE;
|
|
|
|
}
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
ret:
|
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
|
|
|
DBUG_PRINT("info", ("ret: 0 execute_at: %lu", (long) execute_at));
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_RETURN(FALSE);
|
2006-01-18 20:41:22 +01:00
|
|
|
err:
|
2006-04-07 09:08:58 +02:00
|
|
|
DBUG_PRINT("info", ("ret=1"));
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_RETURN(TRUE);
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-14 16:20:48 +01:00
|
|
|
/*
|
2007-03-23 21:08:31 +01:00
|
|
|
Set the internal last_executed MYSQL_TIME struct to now. NOW is the
|
2006-02-14 16:20:48 +01:00
|
|
|
time according to thd->query_start(), so the THD's clock.
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
SYNOPSIS
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_queue_element::mark_last_executed()
|
2006-02-15 19:08:44 +01:00
|
|
|
thd thread context
|
2006-02-14 16:20:48 +01:00
|
|
|
*/
|
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
void
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_queue_element::mark_last_executed(THD *thd)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2007-07-30 10:33:50 +02:00
|
|
|
thd->set_current_time();
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2007-03-21 18:32:15 +01:00
|
|
|
last_executed= (my_time_t) thd->query_start();
|
2006-07-10 13:44:43 +02:00
|
|
|
last_executed_changed= TRUE;
|
2007-03-23 16:14:03 +01:00
|
|
|
|
2006-07-17 16:52:45 +02:00
|
|
|
execution_count++;
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-14 16:20:48 +01:00
|
|
|
/*
|
|
|
|
Saves status and last_executed_at to the disk if changed.
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
SYNOPSIS
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_queue_element::update_timing_fields()
|
2006-02-14 16:20:48 +01:00
|
|
|
thd - thread context
|
|
|
|
|
2006-02-15 19:08:44 +01:00
|
|
|
RETURN VALUE
|
2006-07-11 18:28:15 +02:00
|
|
|
FALSE OK
|
2006-08-17 14:22:59 +02:00
|
|
|
TRUE Error while opening mysql.event for writing or during
|
|
|
|
write on disk
|
2006-02-14 16:20:48 +01:00
|
|
|
*/
|
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
bool
|
2006-07-10 13:44:43 +02:00
|
|
|
Event_queue_element::update_timing_fields(THD *thd)
|
2005-12-05 11:45:04 +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
|
|
|
Event_db_repository *db_repository= Events::get_db_repository();
|
|
|
|
int ret;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-07-10 13:44:43 +02:00
|
|
|
DBUG_ENTER("Event_queue_element::update_timing_fields");
|
2005-12-05 11:45:04 +01:00
|
|
|
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
2007-05-10 11:59:39 +02:00
|
|
|
DBUG_PRINT("enter", ("name: %*s", (int) name.length, name.str));
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
/* No need to update if nothing has changed */
|
2005-12-08 00:17:05 +01:00
|
|
|
if (!(status_changed || last_executed_changed))
|
2006-05-29 10:39:45 +02:00
|
|
|
DBUG_RETURN(0);
|
2006-02-15 19:08:44 +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
|
|
|
ret= db_repository->update_timing_fields_for_event(thd,
|
|
|
|
dbname, name,
|
|
|
|
last_executed_changed,
|
|
|
|
last_executed,
|
|
|
|
status_changed,
|
|
|
|
(ulonglong) status);
|
|
|
|
last_executed_changed= status_changed= FALSE;
|
2005-12-05 11:45:04 +01:00
|
|
|
DBUG_RETURN(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
static
|
|
|
|
void
|
|
|
|
append_datetime(String *buf, Time_zone *time_zone, my_time_t secs,
|
|
|
|
const char *name, uint len)
|
|
|
|
{
|
|
|
|
char dtime_buff[20*2+32];/* +32 to make my_snprintf_{8bit|ucs2} happy */
|
|
|
|
buf->append(STRING_WITH_LEN(" "));
|
|
|
|
buf->append(name, len);
|
|
|
|
buf->append(STRING_WITH_LEN(" '"));
|
|
|
|
/*
|
|
|
|
Pass the buffer and the second param tells fills the buffer and
|
|
|
|
returns the number of chars to copy.
|
|
|
|
*/
|
2007-03-23 21:08:31 +01:00
|
|
|
MYSQL_TIME time;
|
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
|
|
|
time_zone->gmt_sec_to_TIME(&time, secs);
|
|
|
|
buf->append(dtime_buff, my_datetime_to_str(&time, dtime_buff));
|
|
|
|
buf->append(STRING_WITH_LEN("'"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-14 16:20:48 +01:00
|
|
|
/*
|
|
|
|
Get SHOW CREATE EVENT as string
|
2006-02-15 19:08:44 +01:00
|
|
|
|
|
|
|
SYNOPSIS
|
2006-02-28 18:33:38 +01:00
|
|
|
Event_timed::get_create_event(THD *thd, String *buf)
|
2006-02-15 19:08:44 +01:00
|
|
|
thd Thread
|
|
|
|
buf String*, should be already allocated. CREATE EVENT goes inside.
|
|
|
|
|
|
|
|
RETURN VALUE
|
2006-02-20 16:06:05 +01:00
|
|
|
0 OK
|
|
|
|
EVEX_MICROSECOND_UNSUP Error (for now if mysql.event has been
|
|
|
|
tampered and MICROSECONDS interval or
|
|
|
|
derivative has been put there.
|
2006-02-14 16:20:48 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2006-02-28 18:33:38 +01:00
|
|
|
Event_timed::get_create_event(THD *thd, String *buf)
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2006-07-10 13:44:43 +02:00
|
|
|
char tmp_buf[2 * STRING_BUFFER_USUAL_SIZE];
|
|
|
|
String expr_buf(tmp_buf, sizeof(tmp_buf), system_charset_info);
|
2006-02-14 16:20:48 +01:00
|
|
|
expr_buf.length(0);
|
|
|
|
|
|
|
|
DBUG_ENTER("get_create_event");
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
BitKeeper/etc/ignore:
added libmysqld/ha_ndbcluster_cond.cc
---
added debian/defs.mk debian/control
client/completion_hash.cc:
Remove not needed casts
client/my_readline.h:
Remove some old types
client/mysql.cc:
Simplify types
client/mysql_upgrade.c:
Remove some old types
Update call to dirname_part
client/mysqladmin.cc:
Remove some old types
client/mysqlbinlog.cc:
Remove some old types
Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
Remove some old types
client/mysqldump.c:
Remove some old types
Remove some not needed casts
Change some string lengths to size_t
client/mysqlimport.c:
Remove some old types
client/mysqlshow.c:
Remove some old types
client/mysqlslap.c:
Remove some old types
Remove some not needed casts
client/mysqltest.c:
Removed some old types
Removed some not needed casts
Updated hash-get-key function arguments
Updated parameters to dirname_part()
client/readline.cc:
Removed some old types
Removed some not needed casts
Changed some string lengths to use size_t
client/sql_string.cc:
Removed some old types
dbug/dbug.c:
Removed some old types
Changed some string lengths to use size_t
Changed some prototypes to avoid casts
extra/comp_err.c:
Removed some old types
extra/innochecksum.c:
Removed some old types
extra/my_print_defaults.c:
Removed some old types
extra/mysql_waitpid.c:
Removed some old types
extra/perror.c:
Removed some old types
extra/replace.c:
Removed some old types
Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
Removed some old types
extra/resolveip.c:
Removed some old types
include/config-win.h:
Removed some old types
include/decimal.h:
Changed binary strings to be uchar* instead of char*
include/ft_global.h:
Removed some old types
include/hash.h:
Removed some old types
include/heap.h:
Removed some old types
Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
Removed some old types
include/m_ctype.h:
Removed some old types
Changed some string lengths to use size_t
Changed character length functions to return uint
unsigned char -> uchar
include/m_string.h:
Removed some old types
Changed some string lengths to use size_t
include/my_alloc.h:
Changed some string lengths to use size_t
include/my_base.h:
Removed some old types
include/my_dbug.h:
Removed some old types
Changed some string lengths to use size_t
Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
Removed some old types
include/my_global.h:
Removed old types:
my_size_t -> size_t
byte -> uchar
gptr -> uchar *
include/my_list.h:
Removed some old types
include/my_nosys.h:
Removed some old types
include/my_pthread.h:
Removed some old types
include/my_sys.h:
Removed some old types
Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
Changed some string lengths to use size_t
my_malloc() / my_free() now uses void *
Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
Removed some old types
include/my_trie.h:
Removed some old types
include/my_user.h:
Changed some string lengths to use size_t
include/my_vle.h:
Removed some old types
include/my_xml.h:
Removed some old types
Changed some string lengths to use size_t
include/myisam.h:
Removed some old types
include/myisammrg.h:
Removed some old types
include/mysql.h:
Removed some old types
Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
include/queues.h:
Removed some old types
include/sql_common.h:
Removed some old types
include/sslopt-longopts.h:
Removed some old types
include/violite.h:
Removed some old types
Changed some string lengths to use size_t
libmysql/client_settings.h:
Removed some old types
libmysql/libmysql.c:
Removed some old types
libmysql/manager.c:
Removed some old types
libmysqld/emb_qcache.cc:
Removed some old types
libmysqld/emb_qcache.h:
Removed some old types
libmysqld/lib_sql.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
true -> TRUE, false -> FALSE
mysys/array.c:
Removed some old types
mysys/charset.c:
Changed some string lengths to use size_t
mysys/checksum.c:
Include zlib to get definition for crc32
Removed some old types
mysys/default.c:
Removed some old types
Changed some string lengths to use size_t
mysys/default_modify.c:
Changed some string lengths to use size_t
Removed some not needed casts
mysys/hash.c:
Removed some old types
Changed some string lengths to use size_t
Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
Removed some old types
mysys/mf_cache.c:
Changed some string lengths to use size_t
mysys/mf_dirname.c:
Removed some old types
Changed some string lengths to use size_t
Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
Removed some old types
Updated parameters to dirname_part()
mysys/mf_format.c:
Removed some old types
Changed some string lengths to use size_t
mysys/mf_getdate.c:
Removed some old types
mysys/mf_iocache.c:
Removed some old types
Changed some string lengths to use size_t
Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
Removed some old types
Changed some string lengths to use size_t
Clean up comments
Removed not needed indentation
mysys/mf_keycache.c:
Removed some old types
mysys/mf_keycaches.c:
Removed some old types
mysys/mf_loadpath.c:
Removed some old types
mysys/mf_pack.c:
Removed some old types
Changed some string lengths to use size_t
Removed some not needed casts
Removed very old VMS code
Updated parameters to dirname_part()
Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
Removed some old types
mysys/mf_radix.c:
Removed some old types
mysys/mf_same.c:
Removed some old types
mysys/mf_sort.c:
Removed some old types
mysys/mf_soundex.c:
Removed some old types
mysys/mf_strip.c:
Removed some old types
mysys/mf_tempdir.c:
Removed some old types
mysys/mf_unixpath.c:
Removed some old types
mysys/mf_wfile.c:
Removed some old types
mysys/mulalloc.c:
Removed some old types
mysys/my_alloc.c:
Removed some old types
Changed some string lengths to use size_t
Use void* as type for allocated memory area
Removed some not needed casts
Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
More comments
Removed some old types
Changed string lengths to use size_t
Changed arguments to my_uncompress() to make them easier to understand
Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
Changed some string lengths to use size_t
mysys/my_create.c:
Removed some old types
mysys/my_div.c:
Removed some old types
mysys/my_error.c:
Removed some old types
mysys/my_fopen.c:
Removed some old types
mysys/my_fstream.c:
Removed some old types
Changed some string lengths to use size_t
writen -> written
mysys/my_getopt.c:
Removed some old types
mysys/my_getwd.c:
Removed some old types
More comments
mysys/my_init.c:
Removed some old types
mysys/my_largepage.c:
Removed some old types
Changed some string lengths to use size_t
mysys/my_lib.c:
Removed some old types
mysys/my_lockmem.c:
Removed some old types
mysys/my_malloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/my_memmem.c:
Indentation cleanup
mysys/my_once.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
Removed some old types
mysys/my_pread.c:
Removed some old types
Changed all functions to use size_t
Added comment for how my_pread() / my_pwrite() are supposed to work.
Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
(If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
Removed some old types
Changed all functions to use size_t
mysys/my_read.c:
Removed some old types
Changed all functions to use size_t
mysys/my_realloc.c:
Removed some old types
Use void* as type for allocated memory area
Changed all functions to use size_t
mysys/my_static.c:
Removed some old types
mysys/my_static.h:
Removed some old types
mysys/my_vle.c:
Removed some old types
mysys/my_wincond.c:
Removed some old types
mysys/my_windac.c:
Removed some old types
mysys/my_write.c:
Removed some old types
Changed all functions to use size_t
mysys/ptr_cmp.c:
Removed some old types
Changed all functions to use size_t
mysys/queues.c:
Removed some old types
mysys/safemalloc.c:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed all functions to use size_t
mysys/string.c:
Removed some old types
Changed all functions to use size_t
mysys/testhash.c:
Removed some old types
mysys/thr_alarm.c:
Removed some old types
mysys/thr_lock.c:
Removed some old types
mysys/tree.c:
Removed some old types
mysys/trie.c:
Removed some old types
mysys/typelib.c:
Removed some old types
plugin/daemon_example/daemon_example.cc:
Removed some old types
regex/reginit.c:
Removed some old types
server-tools/instance-manager/buffer.cc:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
Removed some old types
Changed some string lengths to use size_t
Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
Changed buffer to be of type uchar*
Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
Removed some old types
server-tools/instance-manager/parse.cc:
Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
Removed some old types
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
Removed some old types
Changed some string lengths to use size_t
sql/derror.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/discover.cc:
Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
Removed some old types
Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
Changed some buffers to be uchar* to avoid casts
Added missing casts for sprintf()
sql/event_queue.cc:
Removed some old types
sql/field.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
Removed some old types
Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes).
Changed some string lengths to use size_t
Removed some not needed casts
Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
Removed some old types
Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
Removed some old types
Changed memory buffers to be uchar*
Changed some string lengths to use size_t
Removed a lot of casts
Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
Added required cast
sql/ha_ndbcluster.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Added required casts
Removed some not needed casts
sql/ha_ndbcluster.h:
Removed some old types
sql/ha_ndbcluster_binlog.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
Changed some string lengths to use size_t
Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
Removed some old types
sql/ha_ndbcluster_cond.cc:
Removed some old types
Removed some not needed casts
sql/ha_ndbcluster_cond.h:
Removed some old types
sql/ha_partition.cc:
Removed some old types
Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
Removed some old types
sql/handler.cc:
Removed some old types
Changed some string lengths to use size_t
sql/handler.h:
Removed some old types
Changed some string lengths to use size_t
Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
Removed some old types
Changed all functions to use size_t
sql/hostname.cc:
Removed some old types
sql/item.cc:
Removed some old types
Changed some string lengths to use size_t
Use strmake() instead of memdup() to create a null terminated string.
Updated calls to new Field()
sql/item.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
Removed some old types
sql/item_create.cc:
Removed some old types
sql/item_func.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added test for failing alloc() in init_result_field()
Remove old confusing comment
Fixed compiler warning
sql/item_func.h:
Removed some old types
sql/item_row.cc:
Removed some old types
sql/item_row.h:
Removed some old types
sql/item_strfunc.cc:
Include zlib (needed becasue we call crc32)
Removed some old types
sql/item_strfunc.h:
Removed some old types
Changed some types to match new function prototypes
sql/item_subselect.cc:
Removed some old types
sql/item_subselect.h:
Removed some old types
sql/item_sum.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/item_sum.h:
Removed some old types
sql/item_timefunc.cc:
Removed some old types
Changed some string lengths to use size_t
sql/item_timefunc.h:
Removed some old types
sql/item_xmlfunc.cc:
Changed some string lengths to use size_t
sql/item_xmlfunc.h:
Removed some old types
sql/key.cc:
Removed some old types
Removed some not needed casts
sql/lock.cc:
Removed some old types
Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Changed usage of pwrite() to not assume it holds the cursor position for the file
Made usage of my_read() safer
sql/log_event.cc:
Removed some old types
Added checking of return value of malloc() in pack_info()
Changed some buffers to be uchar* to avoid casts
Removed some 'const' to avoid casts
Added missing casts for alloc() and sprintf()
Added required casts
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/log_event_old.h:
Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
Removed some old types
sql/my_decimal.cc:
Changed memory area to use uchar*
sql/my_decimal.h:
Changed memory area to use uchar*
sql/mysql_priv.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Changed some string lengths to use size_t
Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
Removed some old types
sql/net_serv.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Ensure that vio_read()/vio_write() return values are stored in a size_t variable
Removed some not needed casts
sql/opt_range.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/opt_range.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
Removed some old types
Removed some not needed casts
sql/parse_file.cc:
Removed some old types
Changed some string lengths to use size_t
Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
Removed some old types
sql/partition_info.cc:
Removed some old types
Added missing casts for alloc()
Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/protocol.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/records.cc:
Removed some old types
sql/repl_failsafe.cc:
Removed some old types
Changed some string lengths to use size_t
Added required casts
sql/rpl_filter.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some string lengths to use size_t
sql/rpl_filter.h:
Changed some string lengths to use size_t
sql/rpl_injector.h:
Removed some old types
sql/rpl_record.cc:
Removed some old types
Removed some not needed casts
Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/rpl_record_old.h:
Removed some old types
Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
Removed some old types
sql/rpl_tblmap.cc:
Removed some old types
sql/rpl_tblmap.h:
Removed some old types
sql/rpl_utility.cc:
Removed some old types
sql/rpl_utility.h:
Removed some old types
Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
sql/set_var.cc:
Removed some old types
Updated parameters to dirname_part()
sql/set_var.h:
Removed some old types
sql/slave.cc:
Removed some old types
Changed some string lengths to use size_t
sql/slave.h:
Removed some old types
sql/sp.cc:
Removed some old types
Added missing casts for printf()
sql/sp.h:
Removed some old types
Updated hash-get-key function arguments
sql/sp_cache.cc:
Removed some old types
Added missing casts for printf()
Updated hash-get-key function arguments
sql/sp_head.cc:
Removed some old types
Added missing casts for alloc() and printf()
Added required casts
Updated hash-get-key function arguments
sql/sp_head.h:
Removed some old types
sql/sp_pcontext.cc:
Removed some old types
sql/sp_pcontext.h:
Removed some old types
sql/sql_acl.cc:
Removed some old types
Changed some string lengths to use size_t
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added required casts
sql/sql_analyse.cc:
Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
Removed some old types
sql/sql_base.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_binlog.cc:
Removed some old types
Added missing casts for printf()
sql/sql_cache.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
Changed some string lengths to use size_t
sql/sql_cache.h:
Removed some old types
Removed reference to not existing function cache_key()
Updated hash-get-key function arguments
sql/sql_class.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc()
Updated hash-get-key function arguments
Moved THD::max_row_length() to table.cc (as it's not depending on THD)
Removed some not needed casts
sql/sql_class.h:
Removed some old types
Changed malloc(), free() and related functions to use void *
Removed some not needed casts
Changed some string lengths to use size_t
Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
Removed some old types
Added required casts
sql/sql_db.cc:
Removed some old types
Removed some not needed casts
Added some cast to my_multi_malloc() arguments for safety
Added missing casts for alloc()
sql/sql_delete.cc:
Removed some old types
sql/sql_handler.cc:
Removed some old types
Updated hash-get-key function arguments
Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_insert.cc:
Removed some old types
Added missing casts for alloc() and printf()
sql/sql_lex.cc:
Removed some old types
sql/sql_lex.h:
Removed some old types
Removed some not needed casts
sql/sql_list.h:
Removed some old types
Removed some not needed casts
sql/sql_load.cc:
Removed some old types
Removed compiler warning
sql/sql_manager.cc:
Removed some old types
sql/sql_map.cc:
Removed some old types
sql/sql_map.h:
Removed some old types
sql/sql_olap.cc:
Removed some old types
sql/sql_parse.cc:
Removed some old types
Trivial move of code lines to make things more readable
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/sql_partition.cc:
Removed some old types
Removed compiler warnings about not used functions
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_partition.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
Removed some old types
Added missing casts for alloc()
Updated hash-get-key function arguments
sql/sql_prepare.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Added missing casts for alloc() and printf()
sql-common/client.c:
Removed some old types
Changed some memory areas to use uchar*
sql-common/my_user.c:
Changed some string lengths to use size_t
sql-common/pack.c:
Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
Added required casts
Changed some buffers to be uchar* to avoid casts
Changed some string lengths to use size_t
sql/sql_select.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some old types
sql/sql_select.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_show.cc:
Removed some old types
Added missing casts for alloc()
Removed some not needed casts
sql/sql_string.cc:
Removed some old types
Added required casts
sql/sql_table.cc:
Removed some old types
Removed compiler warning about not used variable
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
sql/sql_test.cc:
Removed some old types
sql/sql_trigger.cc:
Removed some old types
Added missing casts for alloc()
sql/sql_udf.cc:
Removed some old types
Updated hash-get-key function arguments
sql/sql_union.cc:
Removed some old types
sql/sql_update.cc:
Removed some old types
Removed some not needed casts
sql/sql_view.cc:
Removed some old types
sql/sql_yacc.yy:
Removed some old types
Changed some string lengths to use size_t
Added missing casts for alloc()
sql/stacktrace.c:
Removed some old types
sql/stacktrace.h:
Removed some old types
sql/structs.h:
Removed some old types
sql/table.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
Removed setting of LEX_STRING() arguments in declaration
Added required casts
More function comments
Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
Removed some old types
Changed some string lengths to use size_t
sql/thr_malloc.cc:
Use void* as type for allocated memory area
Changed all functions to use size_t
sql/tzfile.h:
Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
Changed some buffers to be uchar* to avoid casts
Updated hash-get-key function arguments
Added missing casts for alloc()
Removed some not needed casts
sql/uniques.cc:
Removed some old types
Removed some not needed casts
sql/unireg.cc:
Removed some old types
Changed some buffers to be uchar* to avoid casts
Removed some not needed casts
Added missing casts for alloc()
storage/archive/archive_reader.c:
Removed some old types
storage/archive/azio.c:
Removed some old types
Removed some not needed casts
storage/archive/ha_archive.cc:
Removed some old types
Changed type for 'frmblob' in archive_discover() to match handler
Updated hash-get-key function arguments
Removed some not needed casts
storage/archive/ha_archive.h:
Removed some old types
storage/blackhole/ha_blackhole.cc:
Removed some old types
storage/blackhole/ha_blackhole.h:
Removed some old types
storage/csv/ha_tina.cc:
Removed some old types
Updated hash-get-key function arguments
Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
Removed some old types
Removed some not needed casts
storage/csv/transparent_file.cc:
Removed some old types
Changed type of 'bytes_read' to be able to detect read errors
Fixed indentation
storage/csv/transparent_file.h:
Removed some old types
storage/example/ha_example.cc:
Removed some old types
Updated hash-get-key function arguments
storage/example/ha_example.h:
Removed some old types
storage/federated/ha_federated.cc:
Removed some old types
Updated hash-get-key function arguments
Removed some not needed casts
storage/federated/ha_federated.h:
Removed some old types
storage/heap/_check.c:
Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
Removed some old types
storage/heap/ha_heap.cc:
Removed some old types
storage/heap/ha_heap.h:
Removed some old types
storage/heap/heapdef.h:
Removed some old types
storage/heap/hp_block.c:
Removed some old types
Changed some string lengths to use size_t
storage/heap/hp_clear.c:
Removed some old types
storage/heap/hp_close.c:
Removed some old types
storage/heap/hp_create.c:
Removed some old types
storage/heap/hp_delete.c:
Removed some old types
storage/heap/hp_hash.c:
Removed some old types
storage/heap/hp_info.c:
Removed some old types
storage/heap/hp_open.c:
Removed some old types
storage/heap/hp_rfirst.c:
Removed some old types
storage/heap/hp_rkey.c:
Removed some old types
storage/heap/hp_rlast.c:
Removed some old types
storage/heap/hp_rnext.c:
Removed some old types
storage/heap/hp_rprev.c:
Removed some old types
storage/heap/hp_rrnd.c:
Removed some old types
storage/heap/hp_rsame.c:
Removed some old types
storage/heap/hp_scan.c:
Removed some old types
storage/heap/hp_test1.c:
Removed some old types
storage/heap/hp_test2.c:
Removed some old types
storage/heap/hp_update.c:
Removed some old types
storage/heap/hp_write.c:
Removed some old types
Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
Removed some old types
Updated hash-get-key function arguments
Added missing casts for alloc() and printf()
Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
Removed some old types
storage/myisam/ft_boolean_search.c:
Removed some old types
storage/myisam/ft_nlq_search.c:
Removed some old types
storage/myisam/ft_parser.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
Removed some old types
storage/myisam/ft_stopwords.c:
Removed some old types
storage/myisam/ft_update.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
Removed some old types
storage/myisam/ha_myisam.cc:
Removed some old types
storage/myisam/ha_myisam.h:
Removed some old types
storage/myisam/mi_cache.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
Removed some old types
storage/myisam/mi_checksum.c:
Removed some old types
storage/myisam/mi_close.c:
Removed some old types
storage/myisam/mi_create.c:
Removed some old types
storage/myisam/mi_delete.c:
Removed some old types
storage/myisam/mi_delete_all.c:
Removed some old types
storage/myisam/mi_dynrec.c:
Removed some old types
storage/myisam/mi_extra.c:
Removed some old types
storage/myisam/mi_key.c:
Removed some old types
storage/myisam/mi_locking.c:
Removed some old types
storage/myisam/mi_log.c:
Removed some old types
storage/myisam/mi_open.c:
Removed some old types
Removed some not needed casts
Check argument of my_write()/my_pwrite() in functions returning int
Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
Removed some old types
Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
Removed some old types
storage/myisam/mi_preload.c:
Removed some old types
storage/myisam/mi_range.c:
Removed some old types
storage/myisam/mi_rfirst.c:
Removed some old types
storage/myisam/mi_rkey.c:
Removed some old types
storage/myisam/mi_rlast.c:
Removed some old types
storage/myisam/mi_rnext.c:
Removed some old types
storage/myisam/mi_rnext_same.c:
Removed some old types
storage/myisam/mi_rprev.c:
Removed some old types
storage/myisam/mi_rrnd.c:
Removed some old types
storage/myisam/mi_rsame.c:
Removed some old types
storage/myisam/mi_rsamepos.c:
Removed some old types
storage/myisam/mi_scan.c:
Removed some old types
storage/myisam/mi_search.c:
Removed some old types
storage/myisam/mi_static.c:
Removed some old types
storage/myisam/mi_statrec.c:
Removed some old types
storage/myisam/mi_test1.c:
Removed some old types
storage/myisam/mi_test2.c:
Removed some old types
storage/myisam/mi_test3.c:
Removed some old types
storage/myisam/mi_unique.c:
Removed some old types
storage/myisam/mi_update.c:
Removed some old types
storage/myisam/mi_write.c:
Removed some old types
storage/myisam/myisam_ftdump.c:
Removed some old types
storage/myisam/myisamchk.c:
Removed some old types
storage/myisam/myisamdef.h:
Removed some old types
storage/myisam/myisamlog.c:
Removed some old types
Indentation fix
storage/myisam/myisampack.c:
Removed some old types
storage/myisam/rt_index.c:
Removed some old types
storage/myisam/rt_split.c:
Removed some old types
storage/myisam/sort.c:
Removed some old types
storage/myisam/sp_defs.h:
Removed some old types
storage/myisam/sp_key.c:
Removed some old types
storage/myisammrg/ha_myisammrg.cc:
Removed some old types
storage/myisammrg/ha_myisammrg.h:
Removed some old types
storage/myisammrg/myrg_close.c:
Removed some old types
storage/myisammrg/myrg_def.h:
Removed some old types
storage/myisammrg/myrg_delete.c:
Removed some old types
storage/myisammrg/myrg_open.c:
Removed some old types
Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
Removed some old types
storage/myisammrg/myrg_rfirst.c:
Removed some old types
storage/myisammrg/myrg_rkey.c:
Removed some old types
storage/myisammrg/myrg_rlast.c:
Removed some old types
storage/myisammrg/myrg_rnext.c:
Removed some old types
storage/myisammrg/myrg_rnext_same.c:
Removed some old types
storage/myisammrg/myrg_rprev.c:
Removed some old types
storage/myisammrg/myrg_rrnd.c:
Removed some old types
storage/myisammrg/myrg_rsame.c:
Removed some old types
storage/myisammrg/myrg_update.c:
Removed some old types
storage/myisammrg/myrg_write.c:
Removed some old types
storage/ndb/include/util/ndb_opts.h:
Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
Removed some old types
storage/ndb/src/mgmclient/main.cpp:
Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
Removed some old types
Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Added required casts
storage/ndb/tools/delete_all.cpp:
Removed some old types
storage/ndb/tools/desc.cpp:
Removed some old types
storage/ndb/tools/drop_index.cpp:
Removed some old types
storage/ndb/tools/drop_tab.cpp:
Removed some old types
storage/ndb/tools/listTables.cpp:
Removed some old types
storage/ndb/tools/ndb_config.cpp:
Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
Removed some old types
storage/ndb/tools/select_all.cpp:
Removed some old types
storage/ndb/tools/select_count.cpp:
Removed some old types
storage/ndb/tools/waiter.cpp:
Removed some old types
strings/bchange.c:
Changed function to use uchar * and size_t
strings/bcmp.c:
Changed function to use uchar * and size_t
strings/bmove512.c:
Changed function to use uchar * and size_t
strings/bmove_upp.c:
Changed function to use uchar * and size_t
strings/ctype-big5.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-bin.c:
Changed functions to use size_t
strings/ctype-cp932.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-czech.c:
Fixed indentation
Changed functions to use size_t
strings/ctype-euc_kr.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-eucjpms.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-gb2312.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-gbk.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-latin1.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-mb.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-simple.c:
Changed functions to use size_t
Simpler loops for caseup/casedown
unsigned int -> uint
unsigned char -> uchar
strings/ctype-sjis.c:
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-tis620.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-uca.c:
Changed functions to use size_t
unsigned char -> uchar
strings/ctype-ucs2.c:
Moved inclusion of stdarg.h to other includes
usigned char -> uchar
Changed functions to use size_t
Changed character length functions to return uint
strings/ctype-ujis.c:
Changed functions to use size_t
Changed character length functions to return uint
unsigned char -> uchar
strings/ctype-utf8.c:
Changed functions to use size_t
unsigned char -> uchar
Indentation fixes
strings/ctype-win1250ch.c:
Indentation fixes
Changed functions to use size_t
strings/ctype.c:
Changed functions to use size_t
strings/decimal.c:
Changed type for memory argument to uchar *
strings/do_ctype.c:
Indentation fixes
strings/my_strtoll10.c:
unsigned char -> uchar
strings/my_vsnprintf.c:
Changed functions to use size_t
strings/r_strinstr.c:
Removed some old types
Changed functions to use size_t
strings/str_test.c:
Removed some old types
strings/strappend.c:
Changed functions to use size_t
strings/strcont.c:
Removed some old types
strings/strfill.c:
Removed some old types
strings/strinstr.c:
Changed functions to use size_t
strings/strlen.c:
Changed functions to use size_t
strings/strmake.c:
Changed functions to use size_t
strings/strnlen.c:
Changed functions to use size_t
strings/strnmov.c:
Changed functions to use size_t
strings/strto.c:
unsigned char -> uchar
strings/strtod.c:
Changed functions to use size_t
strings/strxnmov.c:
Changed functions to use size_t
strings/xml.c:
Changed functions to use size_t
Indentation fixes
tests/mysql_client_test.c:
Removed some old types
tests/thread_test.c:
Removed some old types
vio/test-ssl.c:
Removed some old types
vio/test-sslclient.c:
Removed some old types
vio/test-sslserver.c:
Removed some old types
vio/vio.c:
Removed some old types
vio/vio_priv.h:
Removed some old types
Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viossl.c:
Changed vio_read()/vio_write() to work with size_t
Indentation fixes
vio/viosslfactories.c:
Removed some old types
vio/viotest-ssl.c:
Removed some old types
win/README:
More explanations
2007-05-10 11:59:39 +02:00
|
|
|
DBUG_PRINT("ret_info",("body_len=[%d]body=[%s]",
|
|
|
|
(int) body.length, body.str));
|
2005-12-05 11:45:04 +01:00
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
if (expression && Events::reconstruct_interval_expression(&expr_buf, interval,
|
|
|
|
expression))
|
2006-02-20 16:06:05 +01:00
|
|
|
DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
|
2006-02-14 16:20:48 +01:00
|
|
|
|
|
|
|
buf->append(STRING_WITH_LEN("CREATE EVENT "));
|
|
|
|
append_identifier(thd, buf, name.str, name.length);
|
|
|
|
|
|
|
|
if (expression)
|
|
|
|
{
|
2006-07-11 18:28:15 +02:00
|
|
|
buf->append(STRING_WITH_LEN(" ON SCHEDULE EVERY "));
|
2006-02-14 16:20:48 +01:00
|
|
|
buf->append(expr_buf);
|
2006-02-16 13:11:16 +01:00
|
|
|
buf->append(' ');
|
|
|
|
LEX_STRING *ival= &interval_type_to_name[interval];
|
|
|
|
buf->append(ival->str, ival->length);
|
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
|
|
|
|
|
|
|
if (!starts_null)
|
|
|
|
append_datetime(buf, time_zone, starts, STRING_WITH_LEN("STARTS"));
|
|
|
|
|
|
|
|
if (!ends_null)
|
|
|
|
append_datetime(buf, time_zone, ends, STRING_WITH_LEN("ENDS"));
|
2006-02-14 16:20:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
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
|
|
|
append_datetime(buf, time_zone, execute_at,
|
|
|
|
STRING_WITH_LEN("ON SCHEDULE AT"));
|
2006-02-14 16:20:48 +01:00
|
|
|
}
|
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
if (on_completion == Event_timed::ON_COMPLETION_DROP)
|
2006-02-14 16:20:48 +01:00
|
|
|
buf->append(STRING_WITH_LEN(" ON COMPLETION NOT PRESERVE "));
|
|
|
|
else
|
|
|
|
buf->append(STRING_WITH_LEN(" ON COMPLETION PRESERVE "));
|
|
|
|
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
if (status == Event_timed::ENABLED)
|
2006-02-14 16:20:48 +01:00
|
|
|
buf->append(STRING_WITH_LEN("ENABLE"));
|
2007-04-05 18:47:22 +02:00
|
|
|
else if (status == Event_timed::SLAVESIDE_DISABLED)
|
|
|
|
buf->append(STRING_WITH_LEN("DISABLE ON SLAVE"));
|
2006-02-14 16:20:48 +01:00
|
|
|
else
|
|
|
|
buf->append(STRING_WITH_LEN("DISABLE"));
|
|
|
|
|
|
|
|
if (comment.length)
|
|
|
|
{
|
|
|
|
buf->append(STRING_WITH_LEN(" COMMENT "));
|
|
|
|
append_unescaped(buf, comment.str, comment.length);
|
|
|
|
}
|
|
|
|
buf->append(STRING_WITH_LEN(" DO "));
|
2006-02-15 19:08:44 +01:00
|
|
|
buf->append(body.str, body.length);
|
2006-02-14 16:20:48 +01:00
|
|
|
|
|
|
|
DBUG_RETURN(0);
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
/**
|
|
|
|
Get an artificial stored procedure to parse as an event definition.
|
2006-07-10 13:44:43 +02:00
|
|
|
*/
|
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
bool
|
|
|
|
Event_job_data::construct_sp_sql(THD *thd, String *sp_sql)
|
2006-07-10 13:44:43 +02:00
|
|
|
{
|
2007-04-13 22:35:56 +02:00
|
|
|
LEX_STRING buffer;
|
|
|
|
const uint STATIC_SQL_LENGTH= 44;
|
2006-07-10 13:44:43 +02:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
DBUG_ENTER("Event_job_data::construct_sp_sql");
|
|
|
|
|
|
|
|
/*
|
|
|
|
Allocate a large enough buffer on the thread execution memory
|
|
|
|
root to avoid multiple [re]allocations on system heap
|
|
|
|
*/
|
|
|
|
buffer.length= STATIC_SQL_LENGTH + name.length + body.length;
|
|
|
|
if (! (buffer.str= (char*) thd->alloc(buffer.length)))
|
|
|
|
DBUG_RETURN(TRUE);
|
|
|
|
|
|
|
|
sp_sql->set(buffer.str, buffer.length, system_charset_info);
|
|
|
|
sp_sql->length(0);
|
|
|
|
|
|
|
|
|
|
|
|
sp_sql->append(C_STRING_WITH_LEN("CREATE "));
|
|
|
|
sp_sql->append(C_STRING_WITH_LEN("PROCEDURE "));
|
|
|
|
/*
|
|
|
|
Let's use the same name as the event name to perhaps produce a
|
|
|
|
better error message in case it is a part of some parse error.
|
|
|
|
We're using append_identifier here to successfully parse
|
|
|
|
events with reserved names.
|
|
|
|
*/
|
|
|
|
append_identifier(thd, sp_sql, name.str, name.length);
|
|
|
|
|
|
|
|
/*
|
|
|
|
The default SQL security of a stored procedure is DEFINER. We
|
|
|
|
have already activated the security context of the event, so
|
|
|
|
let's execute the procedure with the invoker rights to save on
|
|
|
|
resets of security contexts.
|
|
|
|
*/
|
|
|
|
sp_sql->append(C_STRING_WITH_LEN("() SQL SECURITY INVOKER "));
|
|
|
|
|
|
|
|
sp_sql->append(body.str, body.length);
|
|
|
|
|
|
|
|
DBUG_RETURN(thd->is_fatal_error);
|
2006-07-10 13:44:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-14 05:53:05 +02:00
|
|
|
/**
|
|
|
|
Get DROP EVENT statement to binlog the drop of ON COMPLETION NOT
|
|
|
|
PRESERVE event.
|
2006-07-10 13:44:43 +02:00
|
|
|
*/
|
|
|
|
|
2007-04-14 05:53:05 +02:00
|
|
|
bool
|
|
|
|
Event_job_data::construct_drop_event_sql(THD *thd, String *sp_sql)
|
2006-07-10 13:44:43 +02:00
|
|
|
{
|
2007-04-14 05:53:05 +02:00
|
|
|
LEX_STRING buffer;
|
|
|
|
const uint STATIC_SQL_LENGTH= 14;
|
2006-07-10 13:44:43 +02:00
|
|
|
|
2007-04-14 05:53:05 +02:00
|
|
|
DBUG_ENTER("Event_job_data::construct_drop_event_sql");
|
2006-07-10 13:44:43 +02:00
|
|
|
|
2007-04-14 05:53:05 +02:00
|
|
|
buffer.length= STATIC_SQL_LENGTH + name.length*2 + dbname.length*2;
|
|
|
|
if (! (buffer.str= (char*) thd->alloc(buffer.length)))
|
|
|
|
DBUG_RETURN(TRUE);
|
2006-07-10 13:44:43 +02:00
|
|
|
|
2007-04-14 05:53:05 +02:00
|
|
|
sp_sql->set(buffer.str, buffer.length, system_charset_info);
|
|
|
|
sp_sql->length(0);
|
2006-07-13 16:24:55 +02:00
|
|
|
|
2007-04-14 05:53:05 +02:00
|
|
|
sp_sql->append(C_STRING_WITH_LEN("DROP EVENT "));
|
|
|
|
append_identifier(thd, sp_sql, dbname.str, dbname.length);
|
|
|
|
sp_sql->append('.');
|
|
|
|
append_identifier(thd, sp_sql, name.str, name.length);
|
2006-07-13 16:24:55 +02:00
|
|
|
|
2007-04-14 05:53:05 +02:00
|
|
|
DBUG_RETURN(thd->is_fatal_error);
|
|
|
|
}
|
2006-07-13 16:24:55 +02:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
/**
|
|
|
|
Compiles and executes the event (the underlying sp_head object)
|
2006-07-13 16:24:55 +02:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
@retval TRUE error (reported to the error log)
|
|
|
|
@retval FALSE success
|
2006-07-13 16:24:55 +02:00
|
|
|
*/
|
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
bool
|
2007-04-05 18:47:22 +02:00
|
|
|
Event_job_data::execute(THD *thd, bool drop)
|
2006-07-13 16:24:55 +02:00
|
|
|
{
|
2007-04-13 22:35:56 +02:00
|
|
|
String sp_sql;
|
2007-04-14 05:53:05 +02:00
|
|
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
2007-04-13 22:35:56 +02:00
|
|
|
Security_context event_sctx, *save_sctx= NULL;
|
2007-04-14 05:53:05 +02:00
|
|
|
#endif
|
2007-04-13 22:35:56 +02:00
|
|
|
List<Item> empty_item_list;
|
|
|
|
bool ret= TRUE;
|
2006-07-13 16:24:55 +02:00
|
|
|
|
|
|
|
DBUG_ENTER("Event_job_data::execute");
|
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
mysql_reset_thd_for_next_command(thd);
|
2006-07-13 16:24:55 +02:00
|
|
|
|
|
|
|
/*
|
2007-04-13 22:35:56 +02:00
|
|
|
MySQL parser currently assumes that current database is either
|
|
|
|
present in THD or all names in all statements are fully specified.
|
|
|
|
And yet not fully specified names inside stored programs must be
|
|
|
|
be supported, even if the current database is not set:
|
|
|
|
CREATE PROCEDURE db1.p1() BEGIN CREATE TABLE t1; END//
|
|
|
|
-- in this example t1 should be always created in db1 and the statement
|
|
|
|
must parse even if there is no current database.
|
|
|
|
|
|
|
|
To support this feature and still address the parser limitation,
|
|
|
|
we need to set the current database here.
|
|
|
|
We don't have to call mysql_change_db, since the checks performed
|
|
|
|
in it are unnecessary for the purpose of parsing, and
|
|
|
|
mysql_change_db will be invoked anyway later, to activate the
|
|
|
|
procedure database before it's executed.
|
2006-07-13 16:24:55 +02:00
|
|
|
*/
|
2007-04-13 22:35:56 +02:00
|
|
|
thd->set_db(dbname.str, dbname.length);
|
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
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
|
|
|
if (event_sctx.change_security_context(thd,
|
|
|
|
&definer_user, &definer_host,
|
|
|
|
&dbname, &save_sctx))
|
2006-07-13 16:24:55 +02:00
|
|
|
{
|
2007-04-13 22:35:56 +02:00
|
|
|
sql_print_error("Event Scheduler: "
|
|
|
|
"[%s].[%s.%s] execution failed, "
|
|
|
|
"failed to authenticate the user.",
|
|
|
|
definer.str, dbname.str, name.str);
|
2007-06-27 08:06:37 +02:00
|
|
|
goto end_no_lex_start;
|
2006-07-13 16:24:55 +02:00
|
|
|
}
|
2007-04-13 22:35:56 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (check_access(thd, EVENT_ACL, dbname.str,
|
|
|
|
0, 0, 0, is_schema_db(dbname.str)))
|
2007-04-05 18:47:22 +02:00
|
|
|
{
|
|
|
|
/*
|
2007-04-13 22:35:56 +02:00
|
|
|
This aspect of behavior is defined in the worklog,
|
|
|
|
and this is how triggers work too: if TRIGGER
|
|
|
|
privilege is revoked from trigger definer,
|
|
|
|
triggers are not executed.
|
2007-04-05 18:47:22 +02:00
|
|
|
*/
|
2007-04-13 22:35:56 +02:00
|
|
|
sql_print_error("Event Scheduler: "
|
|
|
|
"[%s].[%s.%s] execution failed, "
|
|
|
|
"user no longer has EVENT privilege.",
|
|
|
|
definer.str, dbname.str, name.str);
|
2007-06-27 08:06:37 +02:00
|
|
|
goto end_no_lex_start;
|
2007-04-05 18:47:22 +02:00
|
|
|
}
|
2006-07-13 16:24:55 +02:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
if (construct_sp_sql(thd, &sp_sql))
|
2007-06-27 08:06:37 +02:00
|
|
|
goto end_no_lex_start;
|
2006-07-13 16:24:55 +02:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
/*
|
|
|
|
Set up global thread attributes to reflect the properties of
|
|
|
|
this Event. We can simply reset these instead of usual
|
|
|
|
backup/restore employed in stored programs since we know that
|
|
|
|
this is a top level statement and the worker thread is
|
|
|
|
allocated exclusively to execute this event.
|
|
|
|
*/
|
2006-02-20 16:06:05 +01:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
thd->variables.sql_mode= sql_mode;
|
|
|
|
thd->variables.time_zone= time_zone;
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2007-05-16 13:35:18 +02:00
|
|
|
/*
|
2007-05-16 14:05:19 +02:00
|
|
|
Peculiar initialization order is a crutch to avoid races in SHOW
|
2007-05-16 13:35:18 +02:00
|
|
|
PROCESSLIST which reads thd->{query/query_length} without a mutex.
|
|
|
|
*/
|
|
|
|
thd->query_length= 0;
|
2007-04-13 22:35:56 +02:00
|
|
|
thd->query= sp_sql.c_ptr_safe();
|
|
|
|
thd->query_length= sp_sql.length();
|
2005-12-08 20:37:54 +01:00
|
|
|
|
2005-12-05 11:45:04 +01:00
|
|
|
{
|
2007-04-26 05:38:12 +02:00
|
|
|
Lex_input_stream lip(thd, thd->query, thd->query_length);
|
|
|
|
lex_start(thd);
|
|
|
|
|
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
|
|
|
if (parse_sql(thd, &lip, creation_ctx))
|
2007-04-26 05:38:12 +02:00
|
|
|
{
|
|
|
|
sql_print_error("Event Scheduler: "
|
|
|
|
"%serror during compilation of %s.%s",
|
|
|
|
thd->is_fatal_error ? "fatal " : "",
|
|
|
|
(const char *) dbname.str, (const char *) name.str);
|
|
|
|
goto end;
|
|
|
|
}
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
2006-02-15 19:08:44 +01:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
{
|
|
|
|
sp_head *sphead= thd->lex->sphead;
|
2006-02-28 12:08:13 +01:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
DBUG_ASSERT(sphead);
|
2006-03-16 13:14:40 +01:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
if (thd->enable_slow_log)
|
|
|
|
sphead->m_flags|= sp_head::LOG_SLOW_STATEMENTS;
|
|
|
|
sphead->m_flags|= sp_head::LOG_GENERAL_LOG;
|
2006-01-20 22:24:58 +01:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
sphead->set_info(0, 0, &thd->lex->sp_chistics, sql_mode);
|
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
|
|
|
sphead->set_creation_ctx(creation_ctx);
|
2007-04-13 22:35:56 +02:00
|
|
|
sphead->optimize();
|
2005-12-08 20:37:54 +01:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
ret= sphead->execute_procedure(thd, &empty_item_list);
|
|
|
|
/*
|
|
|
|
There is no pre-locking and therefore there should be no
|
|
|
|
tables open and locked left after execute_procedure.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
2007-06-27 08:06:37 +02:00
|
|
|
if (thd->lex->sphead) /* NULL only if a parse error */
|
|
|
|
{
|
|
|
|
delete thd->lex->sphead;
|
|
|
|
thd->lex->sphead= NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
end_no_lex_start:
|
2007-04-13 22:35:56 +02:00
|
|
|
if (drop && !thd->is_fatal_error)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
We must do it here since here we're under the right authentication
|
|
|
|
ID of the event definer.
|
|
|
|
*/
|
2007-04-14 05:53:05 +02:00
|
|
|
sql_print_information("Event Scheduler: Dropping %s.%s",
|
|
|
|
(const char *) dbname.str, (const char *) name.str);
|
|
|
|
/*
|
|
|
|
Construct a query for the binary log, to ensure the event is dropped
|
|
|
|
on the slave
|
|
|
|
*/
|
|
|
|
if (construct_drop_event_sql(thd, &sp_sql))
|
2007-04-13 22:35:56 +02:00
|
|
|
ret= 1;
|
2007-04-14 05:53:05 +02:00
|
|
|
else
|
|
|
|
{
|
2007-05-16 13:35:18 +02:00
|
|
|
/*
|
2007-05-16 14:05:19 +02:00
|
|
|
Peculiar initialization order is a crutch to avoid races in SHOW
|
2007-05-16 13:35:18 +02:00
|
|
|
PROCESSLIST which reads thd->{query/query_length} without a mutex.
|
|
|
|
*/
|
|
|
|
thd->query_length= 0;
|
2007-04-14 05:53:05 +02:00
|
|
|
thd->query= sp_sql.c_ptr_safe();
|
|
|
|
thd->query_length= sp_sql.length();
|
|
|
|
if (Events::drop_event(thd, dbname, name, FALSE))
|
|
|
|
ret= 1;
|
|
|
|
}
|
2007-04-13 22:35:56 +02:00
|
|
|
}
|
|
|
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
|
|
|
if (save_sctx)
|
|
|
|
event_sctx.restore_security_context(thd, save_sctx);
|
|
|
|
#endif
|
|
|
|
lex_end(thd->lex);
|
|
|
|
thd->lex->unit.cleanup();
|
|
|
|
thd->end_statement();
|
|
|
|
thd->cleanup_after_query();
|
2007-06-15 10:40:30 +02:00
|
|
|
/* Avoid races with SHOW PROCESSLIST */
|
|
|
|
thd->query_length= 0;
|
|
|
|
thd->query= NULL;
|
2005-12-08 20:37:54 +01:00
|
|
|
|
2007-04-13 22:35:56 +02:00
|
|
|
DBUG_PRINT("info", ("EXECUTED %s.%s ret: %d", dbname.str, name.str, ret));
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2005-12-08 20:37:54 +01:00
|
|
|
DBUG_RETURN(ret);
|
2005-12-05 11:45:04 +01:00
|
|
|
}
|
|
|
|
|
2006-02-16 00:43:11 +01:00
|
|
|
|
|
|
|
/*
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
Checks whether two events are in the same schema
|
|
|
|
|
|
|
|
SYNOPSIS
|
2006-07-10 13:44:43 +02:00
|
|
|
event_basic_db_equal()
|
2006-07-11 18:28:15 +02:00
|
|
|
db Schema
|
|
|
|
et Compare et->dbname to `db`
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
|
|
|
|
RETURN VALUE
|
2006-07-10 13:44:43 +02:00
|
|
|
TRUE Equal
|
|
|
|
FALSE Not equal
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
bool
|
2006-07-11 18:28:15 +02:00
|
|
|
event_basic_db_equal(LEX_STRING db, Event_basic *et)
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
{
|
2006-07-11 18:28:15 +02:00
|
|
|
return !sortcmp_lex_string(et->dbname, db, system_charset_info);
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-08-17 14:22:59 +02:00
|
|
|
Checks whether an event has equal `db` and `name`
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
|
|
|
|
SYNOPSIS
|
2006-07-10 13:44:43 +02:00
|
|
|
event_basic_identifier_equal()
|
2006-08-17 14:22:59 +02:00
|
|
|
db Schema
|
|
|
|
name Name
|
|
|
|
et The event object
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
|
|
|
|
RETURN VALUE
|
2006-07-10 13:44:43 +02:00
|
|
|
TRUE Equal
|
|
|
|
FALSE Not equal
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
bool
|
2006-07-10 13:44:43 +02:00
|
|
|
event_basic_identifier_equal(LEX_STRING db, LEX_STRING name, Event_basic *b)
|
fix for bug #17619 Scheduler race conditions
- Scheduler is either initialized at server start or never.
Starting & stopping is now suspending & resuming.
- The scheduler has clear OO interface
- Now all calls to the scheduler are synchronous
- GLOBAL event_scheduler uses thd::sys_var_tmp (see set_var.cc)
- External API is encapsulated into class Events
- Includes fixes for all comments of Kostja's review of 19.05.2005
Starting to merge into 5.1-release (5.1.10) and push
BitKeeper/etc/ignore:
Added libmysqld/event_scheduler.cc to the ignore list
libmysqld/Makefile.am:
executor -> scheduler
mysql-test/r/events.result:
update result
mysql-test/r/events_bugs.result:
update result
mysql-test/r/events_logs_tests.result:
update result
mysql-test/r/events_microsec.result:
update result
mysql-test/r/events_scheduling.result:
update result
mysql-test/r/events_stress.result:
update result
mysql-test/t/disabled.def:
enable these tests
mysql-test/t/events.test:
optimize the test a bit for speed, save some seconds runtime
remove FULL from SHOW EVENTS
mostly use I_S.EVENTS
mysql-test/t/events_bugs.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_logs_tests.test:
optimize the test a bit for speed
mysql-test/t/events_microsec.test:
Skip irrelevant for the current design tests - all events are loaded
on server startup. Change in mysql.event will be visible on next server start.
Don't use numeric error codes.
mysql-test/t/events_scheduling.test:
broader test
mysql-test/t/events_stress.test:
Rework the test to the new architecture of suspending/resuming.
Use less events, no need for thousands, hundreds is still ok.
sql/Makefile.am:
executor -> scheduler
sql/cmakelists.txt:
executor -> scheduler
sql/event.cc:
- remove todo comments
- remove unneded evex_queue abstraction functions
- move events_init() and events_shutdown() from event_executor.cc to here
- export db_create_event
- remove evex_load_and_compile_event, part of class Event_scheduler
- integrate the public interface found in event.h and used by sql_parse.cc
to use the new class Event_scheduler.
sql/event.h:
- add COND_finished so if one thread kills a running event it waits on this
- export callback event_timed_definer_equal, event_timed_identifier_equal(),
event_timed_name_equal and event_timed_db_equal()
to be used by Event_scheduler::drop_matching_events()
- cleanup event.h
- encapsulated all external interface into class Events
sql/event_executor.cc:
make it empty, will delete after that
sql/event_priv.h:
- more things in the private header
- remove event queue abstraction functions. tightly bind to QUEUE
- export privately db_drop_event, db_find_event, db_create_event()
- made change_security_context() and restore_security_context() free functions
sql/event_timed.cc:
- fix calculation of time when ENDS is set (STARTS is always set)
- during Event_timed::compile() set the right Security_ctx. Prevents a crash
during Event_scheduler::load_events_from_db()
- add Event_timed::kill_thread()
- implement event_timed_*_equal()
- made change_security_context() and restore_security_context() free functions.
- Comments cleanups
sql/lex.h:
new word scheduler for SHOW SCHEDULER STATUS (available only debug builds)
sql/log.cc:
move these from event_scheduler.cc
sql/mysql_priv.h:
refactor kill_one_thread
export sql_print_message_func and sql_print_message_handlers
sql/mysqld.cc:
In close_connections, called by kill_server() skip the main scheduler
thread and use events_shutdown() for shutting down the scheduler, in the same
manner it's done for RPL.
Add a new value to --event-scheduler :
0 <- No scheduler available
1 <- Start with scheduler enabled
2 <- Start with scheduler suspended
sql/repl_failsafe.cc:
refactor thd::system_thread to be an enum
sql/set_var.cc:
move sys_var_event_executor::update() to set_var.cc
executor -> scheduler
use thd::sys_var_tmp
sql/set_var.h:
executor -> scheduler
sql/share/errmsg.txt:
3 new error messages
sql/sql_class.cc:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_class.h:
refactor thd::system_thread to be an enum . more type-safety
sql/sql_db.cc:
get the error from evex_drop_schema_events
sql/sql_error.h:
export warning_level_names
sql/sql_lex.h:
new command SHOW SCHEDULER STATUS, available only in debug build and
for debug purposes.
sql/sql_parse.cc:
refactor kill_one_thread() -> does the *dirty* work, and sql_kill
just the reporting.
add handler for SQLCOM_SHOW_SCHEDULER_STATUS
sql/sql_show.cc:
fix verbosity handling (this will be obsoleted anyway by the fix for 17394).
sql/sql_yacc.yy:
remove FULL from SHOW EVENTS
add SHOW SCHEDULER STATUS in debug builds
sql/table.cc:
Fix valgrind warning.
2006-05-22 20:46:13 +02:00
|
|
|
{
|
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
a mutex. Event_parse_data class is used during parsing. It is suited only
for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
the problems of nested events in SP or other events (for the situation
of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
SP was compiled, and not executed, the actual init_xxx methods of Event_timed
were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
now 25% quicker.
Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.
mysql-test/r/events.result:
update result
mysql-test/t/events.test:
disabled is actually wrong, should be disable, but because of the early
checking it was never parsed.
sql/event_data_objects.cc:
move add init_xxx methods from Event_timed to Event_parse_data
Event_parse data does not need definer_user and definer_host
in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.cc:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/events.h:
No more Event_timed comes from parsing but Event_parse_data
The initialization of Item*-s from parsing is done late, and not
during the actual parsing. This is the right way to go because
if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_lex.h:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
sql/sql_parse.cc:
lex->et_compile_phase and lex->et are no more.
Use lex->event_parse_data
ACL checks were moved inside the Events subsystem.
Also ending of the transaction is performed only just
before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
lex->et and lex->et_parse_phase are no more
Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
|
|
|
return !sortcmp_lex_string(name, b->name, system_charset_info) &&
|
|
|
|
!sortcmp_lex_string(db, b->dbname, system_charset_info);
|
2006-02-16 00:43:11 +01:00
|
|
|
}
|
2007-08-15 17:08:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
@} (End of group Event_Scheduler)
|
|
|
|
*/
|