Commit graph

53 commits

Author SHA1 Message Date
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
brian@zim.(none)
5d1d27c016 Final patch to remove the last of the OS2 support. 2006-04-15 18:17:32 -07: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.
260b627f7e save the modified value and compare it every time. the memory address
is not that reliable (re #17815). Not perfect solution but will work
till #17815 is fixed.
2006-03-01 04:22:05 +01:00
andrey@lmy004.
a9884c4c0a fix for bug #16426
Events: Event-caused statements don't appear in the slow query log
WL#1034
2006-03-01 02:34:22 +01:00
andrey@lmy004.
8e881441a1 fix compiler warnings: precision loses, unused vars
the warnings came from MSFT compiler (output of pushbuild)
2006-02-28 20:32:37 +01:00
andrey@lmy004.
991ff4783e class event_timed -> Event_timed
fix for bug#17793 (Scheduler uses class event_timed should be Event_timed)
2006-02-28 18:33:38 +01:00
andrey@lmy004.
796e45a299 don't use magic numbers when there are already constants
(forgotten to be committed)
2006-02-28 17:02:31 +01:00
andrey@lmy004.
780d634496 fix for bug#16537
(post-review pre-push changes)
coding style (mostly trailing spaces removed)
2006-02-28 14:43:49 +01: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
monty@mysql.com
e3796c924f After merge fixes 2006-02-26 15:11:56 +02:00
andrey@lmy004.
11e5e40ede fix for bug #16411 (microseconds are allowed)
last fixes
2006-02-24 14:08:34 +01:00
andrey@lmy004.
c4602da973 merge 2006-02-24 12:03:32 +01:00
andrey@lmy004.
0ba2425caf fix for bug#16407 (EVENTS: sql_mode)
post-review fixes
2006-02-21 02:40:23 +01:00
andrey@lmy004.
2996d95257 fix for bug #16411 Events: Microsecond intervals are allowed
WL#1034
2006-02-20 16:06:05 +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.
8193669f0a cosmetic post-review changes 2006-02-15 21:40:38 +01:00
andrey@lmy004.
a01ed15419 cosmetic changes of the fix for bug#17289 (no privileges checks in EVENTS), before push 2006-02-15 12:14:23 +01:00
andrey@lmy004.
9db6d13cc4 Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into lmy004.:/work/mysql-5.1-bug17289
2006-02-14 23:35:13 +01:00
andrey@lmy004.
3e6376589b make it explicitly extern. this should fix build failure on FC4 2006-02-14 20:58:19 +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.
446c791e56 post-merge fixes 2006-02-14 17:51:22 +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.
d1392cbb30 - use the connection_attib used to spawn threads
in the server. this fixes the problem with the limited number of
  threads because of them being non-detached. pthread_detach_this_tread()
  expands to empty on most platforms including SuSE but pthread_detach(pthread_self())
  is not portable on Windows so the first macro should be used and the thread
  to be detached we have to create it as such.
fix for bug#16984 (Events: running out of threads)
WL#1034 (Internal CRON)
2006-01-31 23:41:21 +01:00
knielsen@mysql.com
56d44ff1f9 Merge mysql.com:/usr/local/mysql/mysql-5.1-win-fixes
into  mysql.com:/usr/local/mysql/x/mysql-5.1-new
2006-01-30 17:57:20 +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
knielsen@mysql.com
899fc2653d Windows compile fixes in preparation for 5.1.6 beta. 2006-01-30 13:09:08 +01:00
andrey@lmy004.
a6494fbe31 Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into lmy004.:/work/mysql-5.1-tt-copy-works
2006-01-23 16:13:46 +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.
0322cb1df8 - fix bug #16435 (Weekly events execute every second) (WL#1034 Internal CRON)
Before the interval expression was considered to be in seconds, now it is
just a number and the type of interval is considered.

- this changeset introduces also fix for bug#16432 (Events: error re interval
  misrepresents the facts)
  the code of event_timed::set_interval() was refactored anyway so it is meaningful to
  fix the bug in the same changeset.
2006-01-18 20:41:22 +01:00
andrey@lmy004.
e385a68fc0 WL #1034 (Internal CRON) post-push update
- fix compile failure on QNX and FreeBSD
2006-01-12 16:51:45 +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.
64d2033f09 WL 1034 update
(pre-push cleanups removing debugging code)
2006-01-10 11:31:45 +01:00
andrey@lmy004.
b95f342fad WL #1034 (update)
- improve the stability of the executor
- make create event if not exists work as before
2005-12-28 12:07:57 +02:00
andrey@lmy004.
fa9f2a773b WL #1034 update
- fix one bug found by PeterG, namely bug #51

#there is a major problem currently after removing the specialised DYNAMIC_ARRAY as 
  storage for the events. I have to reintroduce similar storage, this time probably some
  linked list or maybe some API on top of DYNAMIC_ARRAY.
2005-12-20 14:21:02 +02:00
andrey@lmy004.
67a8172207 WL #1034 update
- handle crashes where the table definition has been changed
  (different number of fields)
2005-12-16 12:42:39 +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.
831569cb2d WL#1034 (update)
- fixed silly bug, the main thread restarted but did not execute events,
  Quite currious why many calls to pthread_mutex_init() do not lead to abort()
2005-12-13 23:10:29 +01:00
andrey@lmy004.
ba79f499e6 WL#1034 update
(cleanups, leaks fixed)
2005-12-13 19:16:00 +01:00
andrey@lmy004.
854d2d4bcd WL#1034 update
cleanup before throwin away DYNAMIC_ARRAY for event storage,
once reallocated I get dangling pointers so that's not good.
solution will be found however ;)
2005-12-13 13:21:11 +01:00
andrey@lmy004.
d94bae3a21 WL#1034 update
QUEUE implementation working now. this should be ready more or less
for testing once the debug output is being cleaned and some things
around DYNAMIC_ARRAY are cleaned
- fix handling in case of errors that lead to crashes, now no more crashes
  in case of table corruption and such.
2005-12-12 21:19:19 +01:00
andrey@lmy004.
56db09cfe6 WL #1034 update
- handle better non-latin1 identifiers
2005-12-08 20:37:54 +01:00
andrey@lmy004.
3d85464143 WL #1034 updates after review
(strip m_ as prefix from member variables' names)
2005-12-08 00:17:05 +01:00
andrey@lmy004.
b7578df06c WL #1034 updates after review 2005-12-07 22:29:00 +01:00