summaryrefslogtreecommitdiff
path: root/mysql-test/r/events.result
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2006-02-07 19:28:33 +0100
committerunknown <andrey@lmy004.>2006-02-07 19:28:33 +0100
commit99eb6eb6610155f279508c86853d9133d1089bf2 (patch)
tree80ddd1d1c8c9db2eae4c7b9989aefb553fca9401 /mysql-test/r/events.result
parent5f67b29f617e917b9e8f03d78ae90e7bc8a831d6 (diff)
downloadmariadb-git-99eb6eb6610155f279508c86853d9133d1089bf2.tar.gz
- fix for bug #16414 (Events: Crash or hang if event drops itself)
WL#1034 (Internal CRON) (with post-review fix) mysql-test/r/events.result: update the result mysql-test/t/events.test: use --sleep instead of select sleep() enable some scheduler related tests. They were disabled because of a hang that happened. The hang is fixed with this bugfix. sql/event.cc: - evex_remove_from_cache reports back whether the in_memory object was deleted or was scheduled. In case scheduling then don't delete it from outside but let it do it itself - move out db interaction code out of evex_drop_event to db_drop_event so it can be called from outter space :) sql/event_priv.h: - export the new function db_drop_event() sql/event_timed.cc: - use db_drop_event() and don't implement the dropping ourselves sql/sql_parse.cc: - some debug info about the status code returned.
Diffstat (limited to 'mysql-test/r/events.result')
-rw-r--r--mysql-test/r/events.result76
1 files changed, 67 insertions, 9 deletions
diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result
index 41f944ab089..6048dbd3012 100644
--- a/mysql-test/r/events.result
+++ b/mysql-test/r/events.result
@@ -15,20 +15,11 @@ create event event2 on schedule every 2 second starts now() ends date_add(now(),
drop event event2;
create event e_43 on schedule every 1 second do set @a = 5;
set global event_scheduler = 1;
-select sleep(2);
-sleep(2)
-0
alter event e_43 do alter event e_43 do set @a = 4;
-select sleep(3);
-sleep(3)
-0
select db, name, body, status, interval_field, interval_value from mysql.event;
db name body status interval_field interval_value
events_test e_43 set @a = 4 ENABLED SECOND 1
drop event e_43;
-select sleep(1);
-sleep(1)
-0
set global event_scheduler = 0;
create table t_event3 (a int, b float);
drop event if exists event3;
@@ -121,6 +112,7 @@ drop event two_event;
drop event three_event;
drop user ev_test@localhost;
drop event one_event;
+"Sleep a bit so the server closes the second connection"
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
@@ -137,4 +129,70 @@ set event_scheduler=0;
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
set global event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
+"DISABLE the scheduler. Testing that it does not work when the variable is 0"
+set global event_scheduler=0;
+select definer, name, db from mysql.event;
+definer name db
+select get_lock("test_lock1", 20);
+get_lock("test_lock1", 20)
+1
+create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
+"Should return 1 row"
+select definer, name, db from mysql.event;
+definer name db
+root@localhost закачка events_test
+"Should be only 1 process"
+show processlist;
+Id User Host db Command Time State Info
+# root localhost events_test Query # NULL show processlist
+select release_lock("test_lock1");
+release_lock("test_lock1")
+1
+drop event закачка;
+"Should have 0 events"
+select count(*) from mysql.event;
+count(*)
+0
+"ENABLE the scheduler and get a lock"
+set global event_scheduler=1;
+select get_lock("test_lock2", 20);
+get_lock("test_lock2", 20)
+1
+"Create an event which tries to acquire a mutex. The event locks on the mutex"
+create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
+"Let some time pass to the event starts"
+"Should have only 3 processes: the scheduler, our conn and the locked event"
+show processlist;
+Id User Host db Command Time State Info
+# root localhost events_test Query # NULL show processlist
+# event_scheduler NULL Connect # Sleeping NULL
+# root events_test Connect # User lock select get_lock("test_lock2", 20)
+"Release the mutex, the event worker should finish."
+select release_lock("test_lock2");
+release_lock("test_lock2")
+1
+drop event закачка;
+set global event_scheduler=1;
+select get_lock("test_lock2_1", 20);
+get_lock("test_lock2_1", 20)
+1
+create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
+"Should see 2 processes, one locked on get_lock("
+"Shutting down the scheduler, it should wait for the running event"
+set global event_scheduler=0;
+"Should have only 3 processes: the scheduler, our conn and the locked event"
+show processlist;
+Id User Host db Command Time State Info
+# root localhost events_test Query # NULL show processlist
+# event_scheduler NULL Connect # Sleeping NULL
+# root events_test Connect # User lock select get_lock("test_lock2_1", 20)
+"Release the lock so the child process should finish. Hence the scheduler also"
+select release_lock("test_lock2_1");
+release_lock("test_lock2_1")
+1
+"Should have only our process now:"
+show processlist;
+Id User Host db Command Time State Info
+# root localhost events_test Query # NULL show processlist
+drop event закачка21;
drop database events_test;