Commit graph

40 commits

Author SHA1 Message Date
davi@mysql.com/endora.local
1c6768c487 Bug#32633 Can not create any routine if SQL_MODE=no_engine_substitution
The problem is that one can not create a stored routine if sql_mode
contains NO_ENGINE_SUBSTITUTION or PAD_CHAR_TO_FULL_LENGTH. Also when
a event is created, the mode is silently lost if sql_mode contains one
of the aforementioned.  This was happening because the table definitions
which stored sql_mode values weren't being updated to accept new values
of sql_mode.

The solution is to update, in a backwards compatible manner, the various
table definitions (columns) that store the sql_mode value to take into
account the new possible values. One incompatible change is that if a event
that is being created can't be stored to the mysql.event table, an error
will be raised.

The tests case also ensure that new SQL modes will be added to the mysql.proc
and mysql.event tables, otherwise the tests will fail.
2008-02-07 08:47:39 -02:00
dkatz@damien-katzs-computer.local
5b01a77c9c Bug #31332 --event-scheduler option misbehaving
Changed the behaviour of the --event-scheduler option when used without an arguments. It
now turns the option on.
2007-10-22 15:16:43 -04:00
anozdrin/alik@station.
c60397ef19 Patch for BUG#31111: --read-only crashes MySQL (events fail to load).
There actually were several problems here:
  - WRITE-lock is required to load events from the mysql.event table,
    but in the read-only mode an ordinary user can not acquire it;
  - Security_context::master_access attribute was not properly
    initialized in Security_context::init(), which led to differences
    in behavior with and without debug configure options.
  - if the server failed to load events from mysql.event, it forgot to
    close the mysql.event table, that led to the coredump, described
    in the bug report.

The patch is to fix all these problems:
  - Use the super-user to acquire WRITE-lock on the mysql.even table;
  - The WRITE-lock is acquired by the event scheduler in two cases:
    - on initial loading of events from the database;
    - when an event has been executed, so its attributes should
      be updated.
    Other cases when WRITE-lock is needed for the mysql.event table
    happen under the user account. So, nothing should be changed there
    for the read-only mode. The user is able to create/update/drop
    an event only if he is a super-user.
  - Initialize Security_context::master_access;
  - Close the mysql.event table in case something went wrong.
2007-10-19 19:57:08 +04:00
thek@adventure.(none)
13d5119416 Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
Creating an EVENT to be executed at a time close to the end of the allowed
range (2038.01.19 03:14:07 UTC) would cause the server to crash. The
expected behavior is to accept all calendar times within the interval and
reject all other values without crashing.

This patch replaces the function 'sec_to_epoch_TIME' with a Time_zone API call.
This function was broken because it invoked the internal function 'sec_to_epoch'
without respecting the restrictions on the function parameters (and this caused
assertion failure). It also was used as a reverse function to
Time_zone_utc::gmt_sec_to_TIME which it isn't.
2007-07-25 09:43:49 +02:00
igor@olga.mysql.com
2efac22463 Corrected a test case. 2007-07-01 11:00:29 -07:00
igor@olga.mysql.com
eea7dd0a77 Made test case platform independent. 2007-07-01 01:59:05 -07:00
holyfoot/hf@mysql.com/hfmain.(none)
be9257966d events_bugs.test didn't remove all the objects it created
what caused some consequitive tests failures
2007-06-28 13:34:39 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
8f7cc6997a Bug #29156 events crash server in test suite
don't free thd->lex->sphead if we didn't do lex_start(),
as we can have garbage there
2007-06-27 11:06:37 +05:00
andrey@whirlpool.mysql.com
a0489dbf18 Fix for
bug#26338 events_bugs.test fail on Debian
and
bug#28285 Test "events_bugs" has instable results of "select /*1*/ ... from processlist"
2007-05-26 16:36:38 +02:00
andrey@whirlpool.mysql.com
47c0c5a0ee Fix for bug#28666 CREATE EVENT ... EVERY 0 SECOND let server crash
A missing check for zero value of interval was added.
2007-05-25 14:46:22 +02:00
kostja@vajra.(none)
35ad681618 An attempt to fix event_bugs.test failure on Debian
(Bug#26338 "events_bugs.test fail on Debian")
2007-05-16 16:01:14 +04:00
kostja@vajra.(none)
98db230086 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
2007-04-05 15:24:34 +04:00
kostja@bodhi.local
c392623bf9 Fix spelling (recursivity -> recursion) 2007-03-27 22:15:51 +04:00
kroki/tomash@moonlight.home
6d8f6b5bfd 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.
2007-03-16 17:31:07 +03:00
kroki/tomash@moonlight.home
a4017eceb1 BUG#16425: Events: no DEFINER clause
There was already support for CREATE DEFINER=... EVENT syntax in the
parser, but DEFINER information was ignored.

This patch adds processing of DEFINER, and a new ALTER DEFINER=...
EVENT syntax.
2007-02-02 20:43:33 +03:00
kroki/tomash@moonlight.home
68a4db3503 BUG#25211: events_bugs.test fails on sapsrv1
The problem was that the events_bugs test could randomly fail due to
races in the test case.

The solution is to replace fixed sleeps with reliable polling of a
certain state to settle.  For that, a new auxiliary script
include/wait_condition.inc is used, that allows waiting for a given
query to return true.
2007-01-19 18:33:48 +03:00
andrey@example.com
12a68db3d3 Additional fix for bug#22369 2006-12-07 13:57:39 +01:00
andrey@example.com
35238085d6 fix for bug#24396 2006-11-22 14:06:59 +01:00
andrey@example.com
c27a88ca2d Better fix for bug#22830
Events: crash with procedure which alters events with function

Post-review CS

This fix also changes the handling of KILL command combined with
subquery. It changes the error message given back to "not supported",
from parse error. The error for CREATE|ALTER EVENT has also been changed
to generate "not supported yet" instead of parse error.
In case of a SP call, the error is "not supported yet". This change
cleans the parser from code which should not belong to there. Still
LEX::expr_allows_subselect is existant because it simplifies the handling
 of SQLCOM_HA_READ which forbids subselects.
2006-11-02 13:51:43 +01:00
andrey@example.com
db3a25fd78 Fix for bug#22397 Events: crash with procedure which alters events
ALTER EVENT in stored procedure body led to a crash during the
procedure call. Affected was only ALTER EVENT which changed the
interval of the event. No problems with AT, STARTS, ENDS and so on.
2006-09-25 16:49:25 +02:00
andrey@example.com
83f4f3b2aa fix build 2006-09-08 00:49:37 +02:00
andrey@example.com
ca39997c0e WL#3337 (Event scheduler new architecture)
This is a post-review patch.

Fixes the typelib implementation, available only in 5.1.11.

--event-scheduler cmdline : DISABLED | ON | OFF | 0 | 1
DISABLED - makes the scheduler unavailable during the server run
(ON|1)-  When the server is started the scheduler will be started. It can
         be stopped and restarted by setting appropriate values to
         GLOBAL event_scheduler
(OFF|0)- When the server is started, the scheduler won't be started. It
         can be started and again stopped by setting appropriate values to
         GLOBAL event_scheduler. _DEFAULT_ value

The GLOBAL variable event_scheduler can have the following values:
OFF | ON | 0 | 1
DISABLED is not possible and every attempt will end with an error that
it's not a valid value for the variable.
OFF | 0 - This is the pre-5.1.11 behavior - The scheduler stops, if not
          already stopped, and can be started again  by setting
          the value of the variable to ON|1.
ON | 1  - This is the pre-5.1.11 behavior - The scheduler starts, if not
          already started, and can be stopped again by setting the value
          of the variable to OFF|0.
2006-09-01 13:08:44 +02:00
andrey@example.com
5b2608db9b post-merge and testing fixes 2006-08-15 00:50:26 +02:00
andrey@lmy004.
0404763d81 WL#3337 (Events new architecture)
Small updates before patch submit.
2006-07-17 16:52:45 +02:00
andrey@lmy004.
e3d0524bbd WL#3337 (Event scheduler new architecture)
This patch introduces specialized Event data objects
Event_basic as parent.
Event_queue_element used for queue storage
Event_timed used for SHOW EVENTS/ I_S.EVENTS / SHOW CREATE EVENT
Event_job_data using during execution.
Methods were moved out of Event_timed to other classes.

This patch also introduces Events::LOCK_event_metadata.
This patch gives new implementation of Events::dump_internal_status().
Now both the Event_scheduler and Event_queue return information during
their ::dump_internal_status().

Shortened a bit the runtime for executing events test cases.
2006-07-10 13:44:43 +02:00
andrey@lmy004.
4d22fd1acf fix for bug#16394 "Events: Crash if schedule contains SELECT"
Parsing of CREATE/ALTER EVENT statement was crashing because of early
initialization done during parsing, instead in the after parsing phase.
Moreover, we don't want SUBqueries in CREATE/ALTER EVENT therefore we
disable them, though it is possible to make them work. It can be emulated
inside SP with a cursor and SP variable (CREATE/ALTER EVENT can still
accept variables as values).
2006-06-29 11:53:51 +02:00
andrey@lmy004.
0c439c9f76 WL#3337 (Event scheduler new architecture) Fourth cut of refactoring
the parsing. Next step will be to refactor of usage of Event_timed 
during Events::create_event() and Events::update_event().

Disallow:
- CREATE EVENT ... DO CREATE EVENT ...;
- ALTER  EVENT ... DO CREATE EVENT ...;
- CREATE EVENT ... DO ALTER EVENT DO ....;
- CREATE PROCEDURE ... BEGIN CREATE EVENT ... END|

Allowed:
- CREATE EVENT ... DO DROP EVENT yyy;
- CREATE EVENT ... DO ALTER EVENT yyy;
  (the nested ALTER EVENT can have anything but DO clause)
- ALTER  EVENT ... DO ALTER EVENT yyy;
  (the nested ALTER EVENT can have anything but DO clause)
- ALTER  EVENT ... DO DROP EVENT yyy;
- CREATE PROCEDURE ... BEGIN ALTER EVENT ... END|
  (the nested ALTER EVENT can have anything but DO clause)
- CREATE PROCEDURE ... BEGIN DROP EVENT ... END|
2006-06-27 13:15:40 +02:00
andrey@lmy004.
d617241c3f Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into lmy004.:/work/mysql-5.1-runtime-bug18897
2006-06-26 08:55:49 +02:00
andrey@lmy004.
e71ef73d53 Fix for bug #18897 "Events: unauthorized action possible with
alter event rename".

ALTER EVENT ... RENAME statement hasn't checked privileges
for the target database. It also caused server crashes when
target database was not specified explicitly and there was
no current database.

This fix adds missing privilege check and check for the case
when target database is not specified explicitly or implicitly.
2006-06-23 17:29:01 +02:00
andrey@lmy004.
08f9d359d4 disable events tests in embedded
(fix for bug#20290 Event mechanism incompatible with embedded server, but tests tried)
2006-06-23 09:40:06 +02:00
andrey@lmy004.
b429d73d62 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
2006-05-22 20:46:13 +02:00
andrey@lmy004.
fe2e9a903f Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into lmy004.:/work/mysql-5.1-bug14356
2006-03-28 10:42:46 +02:00
andrey@lmy004.
75cba7b5cc manual merge 2006-03-25 00:24:04 +01:00
andrey@lmy004.
531ad766ed fix for bug#16415 Events names are case sensitive 2006-03-24 17:45:52 +01:00
andrey@lmy004.
50efe4ed28 fix after manual merge of fix for bug #16396: Events: Distant-future dates become past dates. 2006-03-17 11:01:45 +01:00
andrey@lmy004.
a1d87d6a0d manual merge 2006-03-17 09:40:48 +01:00
andrey@lmy004.
dd1b001253 fix for bug #17578: Test "events" fails due to scheduling difference 2006-03-16 16:41:00 +01:00
andrey@lmy004.
23888ae52c fix for bug 16408 (Events: crash for an event in a procedure)
(one patch)
2006-03-16 13:14:40 +01:00
andrey@lmy004.
3c67b8039e fix for bug #16396: Events: Distant-future dates become past dates
WL#1034 (Internal CRON)
timestamps does not support > y2038
2006-03-03 01:39:11 +01:00
andrey@lmy004.
22ba4ca3a3 fix for bug#16407 (Events: Changes in sql_mode won't be taken into account)
WL#1032
sql_mode setting was disregarded during create/alter event and wasn't set during
event execution.
(post-review small fixes)
2006-02-20 23:52:22 +01:00