Commit graph

50 commits

Author SHA1 Message Date
ahristov@bk-internal.mysql.com
75eeececb1 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1-runtime
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-wl3337
2006-09-06 14:35:27 +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
stewart@willster.(none)
6a6b5eb137 BUG#21647 events tests fails with --with-ndbcluster
ignore the ndb injector thread when selecting from INFORMATION_SCHEMA.PROCESSLIST
2006-08-15 19:53:16 +08: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.
0d517461f0 WL#3337 (Event scheduler new architecture)
More small fixes to the API : use LEX_STRING instead of LEX_STRING* and if error
then return bool(true) instead of error code.
Merged functions. Reduced usage of sp_name.
Fixed a lot of function documentation errors.
Added function documentation wherever needed.
Removed some unused defines and error codes.

Next to come is batch rename of Event_scheduler_ng to Event_scheduler.
2006-07-11 18:28:15 +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.
3c793e23ee 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.
2006-06-29 00:42:25 +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.
23340f3fdd Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into lmy004.:/work/mysql-5.1-runtime-bug16992
2006-06-26 12:22:13 +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.
c59a58c4ba fix for bug#16992 (Events: Information_schema troubles)
Introduced EVENTS.EVENT_DEFINITION, like ROUTINES.ROUTINE_DEFINITION
Hence, the contents of the current EVENTS.EVENT_BODY become the contents
of EVENT_DEFINITION. EVENT_BODY will contain always, for now, "SQL" (wo
quotes).
2006-06-22 13:01:08 +02:00
andrey@lmy004.
b4752351f2 Fix for bug #17394 - Events namespace is wrong 2006-05-29 10:39:45 +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
jimw@mysql.com
3761b25696 Bug #18495: mysqltest does not use the correct error number
When looking up the error number for named errors in mysqltest .test
  files, we inadvertantly would match ER_WRONG_VALUE against
  ER_WRONG_VALUE_COUNT because we were using the length of the shorter
  string in strncmp(). Now we double-check the length of matches to
  make sure it was a complete match.
2006-04-21 19:29:22 -07:00
andrey@lmy004.
bdfdd38f60 update tests 2006-04-07 11:29:15 +02:00
andrey@lmy004.
7bd09ac24d manual merge 2006-04-07 09:18:29 +02:00
andrey@lmy004.
36cfa4dfa1 fix for bug #17494 (The algorithm for calculating execution times is not fully correct)
This also should fix 17493 and 17346, and probably 16397 (not tested).
WL#1034 (Internal CRON)
(post-review commit)
2006-04-07 09:08:58 +02:00
andrey@lmy004.
dd1b001253 fix for bug #17578: Test "events" fails due to scheduling difference 2006-03-16 16:41:00 +01:00
konstantin@mysql.com
386ec52a6b A fix and test case for Bug#16164 "Easter egg":
SHOW AUTHORS caused 'Packets out of order' in stored functions:
add the corresponding SQLCOM to sp_get_flags_for_command so that
it'd return sp-related flags for it. 
Fix Bug#17403 "Events: packets out of order with show create event"
in the same chaneset.
2006-03-15 20:21:59 +03:00
andrey@lmy004.
8fe55c09db manual merge 2006-02-28 12:08:13 +01:00
andrey@lmy004.
483a6d06fa fix for bug#16537 (Events: mysql.event.starts is null)
- now when the event is created and STARTS is omitted then STARTS is implicitly
  CURRENT_TIMESTAMP
- This CS also fixed incorrect presentation of STARTS/ENDS in I_S.EVENTS
(incorporated review changes)
2006-02-28 11:43:10 +01:00
andrey@lmy004.
4e4520b723 fix for bug#17543 Creating Event crash the server
this problem affects only debug builds
2006-02-16 16:11:02 +01:00
andrey@lmy004.
7b2650a256 small post-merge fixes for bug#16406
(pre-push)
2006-02-16 05:21:02 +01:00
andrey@lmy004.
2158add8f0 merge 2006-02-16 01:27:36 +01:00
andrey@lmy004.
d3e0875759 fix for bug#16406 (Events: DROP DATABASE doesn't automatically drop events)
WL#1034
- This changeset also changes the executor so its quite more stable now.
  Stressing test case added that executes ~800 events per second and dropping
  hundreds of events at once using DROP DATABASE.
(with fixes after review of JimW)
(with fixes after review of Serg)
2006-02-16 00:43:11 +01:00
andrey@lmy004.
189baa169b merging before test + push 2006-02-15 21:51:57 +01:00
andrey@lmy004.
32ae54bdbc fix for bug#16410 (Events: CREATE EVENT is legal in a CREATE TRIGGER statement)
WL#1034 (Internal CRON)
(post-post-review updates)
2006-02-15 17:12:27 +01:00
andrey@lmy004.
6d54ee58a4 manual merge 2006-02-14 20:27:42 +01:00
andrey@lmy004.
e9af8c1d83 post-merge fixes of bug 16548 2006-02-14 20:10:51 +01:00
andrey@lmy004.
a47a706d1f Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into lmy004.:/work/mysql-5.1-bug17289
2006-02-14 19:44:10 +01:00
andrey@lmy004.
d5d11a9c23 manual merge 2006-02-14 17:05:36 +01:00
andrey@lmy004.
815927e590 - final fixes for bug#16431 (Events: An event which alters itself disappears)
- fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work)
- this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements
  by committing the currently open transaction before they are executed.
- this Changeset also fixes a trailing space problem since the very early days
  of the internal cron
- adds sophisticated checking of whether mysql.event was tampered accidentally
  or with purpose by an user.
- adds a lot of inline function documentation - documents everything left
  uncodumented
- INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD

WL#1034 (Internal CRON)
2006-02-14 16:20:48 +01:00
andrey@lmy004.
3e89e1ccb2 fix for bug #17289 Events: missing privilege check for drop database
Events were executed with all privileges possible on planet Earth :(
WL#1034
2006-02-10 15:02:57 +01:00
andrey@lmy004.
541e67342f from fix for bug#16414 (Events: Crash or hang if event drops itself)
WL #1034
2006-02-09 23:15:47 +01:00
andrey@lmy004.
4ba2a3322b - fix for bug #16414 (Events: Crash or hang if event drops itself)
WL#1034 (Internal CRON)
(with post-review fix)
2006-02-07 19:28:33 +01:00
andrey@lmy004.
08892be32d post-merge fixes of fix for bug#16642 (No I_S.EVENTS table)
WL#1034 (Internal CRON)
2006-01-30 17:12:30 +01:00
andrey@lmy004.
9d7d8767dd post-commit merge 2006-01-30 14:28:48 +01:00
andrey@lmy004.
d847ac54ca 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
2006-01-30 13:15:23 +01:00
andrey@lmy004.
1a86c35783 post-commit fix of fix for bug#16419
WL#1034 (Internal CRON)
(not interesting for the Changelog)
2006-01-26 22:18:40 +01:00
andrey@lmy004.
d62d8ac9f7 Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into lmy004.:/work/mysql-5.1-bug16419
2006-01-26 21:26:19 +01:00
andrey@lmy004.
d4321d9b7c fix for bug#16419 (Events: can't use timestamp in the schedule)
WL #1034 (Internal CRON)
2006-01-26 21:21:21 +01:00
andrey@lmy004.
8519423890 fix for bug#16404 (Events: keyword is ENABLED rather than ENABLE)
WL#1034 (Internal CRON)
2006-01-24 16:04:35 +01:00
andrey@lmy004.
7740652961 fix for bug#16431 (Events: An event which alters itself disappears)
WL#1034 (Internal CRON)
2006-01-20 22:24:58 +01:00
andrey@lmy004.
b9a0a5dd57 fix for bug#16548 (Events: can't alter clause for preserve)
WL #1034 (Internal CRON)
2006-01-20 16:12:44 +01:00
andrey@lmy004.
a6d4732ccb WL #1034
- add a bit more debug messages
- disable events.test for now due to a bug
2006-01-11 19:31:21 +01:00
andrey@lmy004.
71eb7d7ec9 WL #1034 (Internal CRON) pre-push updates
- various fixes of test cases
(hopefully the last pre-push update before the push)
2006-01-11 18:09:05 +01:00
andrey@lmy004.
d2f0002e77 WL #1034 (Internal CRON) pre-push updates
- fixed test results
- fixed bug caught by information_schema.test . Bison temporal
  variables are very nice but extremely error-prone (Count one more
  time just to be sure).
2006-01-10 19:16:58 +01:00
andrey@lmy004.
533180d76c WL#1034 update
- fix EVENT_ACL problem that GRANT ALL on some_db.* to someone@somewhere did not get to mysql.db
- fix crash when the following is executed :
  CREATE EVENT P() CREATE EVENT E ON SCHEDULER 1 SECOND DO ROLLBACK;
  (creation works as well as calling P() which creates the event).
2005-12-15 14:12:28 +01:00
andrey@lmy004.
96f9681c6f add test case with \n at EOF 2005-12-02 13:28:14 +01:00