You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
create event e_43 on schedule every 1 second do set @a = 5;
90
-
set global event_scheduler = 1;
91
90
alter event e_43 do alter event e_43 do set @a = 4;
92
91
ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
93
92
alter event e_43 do
@@ -207,6 +206,10 @@ ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
207
206
SHOW EVENTS;
208
207
ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND'
209
208
drop event root22;
209
+
create event root23 on schedule every -100 year do select 1;
210
+
ERROR HY000: INTERVAL is either not positive or too big
211
+
create event root23 on schedule every 222222222222222222222 year do select 1;
212
+
ERROR HY000: INTERVAL is either not positive or too big
210
213
drop event root6;
211
214
drop event root7;
212
215
drop event root8;
@@ -342,7 +345,7 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
342
345
"Should have only 2 processes: the scheduler and the locked event"
343
346
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
344
347
user host db command state info
345
-
event_scheduler localhost NULL Connect Waiting for next activation NULL
348
+
event_scheduler localhost NULL Daemon Waiting for next activation NULL
346
349
root localhost events_test Connect User lock select get_lock("test_lock2", 20)
347
350
"Release the mutex, the event worker should finish."
348
351
"Release the mutex, the event worker should finish."
@@ -358,7 +361,7 @@ create event закачка21 on schedule every 10 hour do select get_lock("test
358
361
"Should have only 3 processes: the scheduler, our conn and the locked event"
359
362
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
360
363
user host db command state info
361
-
event_scheduler localhost NULL Connect Waiting for next activation NULL
364
+
event_scheduler localhost NULL Daemon Waiting for next activation NULL
362
365
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
26
26
ERROR HY000: ENDS is either invalid or before STARTS
27
+
create event e_55 on schedule at 10000101000000 do drop table t;
28
+
ERROR HY000: Activation (AT) time is in the past
29
+
create event e_55 on schedule at 20000101000000 do drop table t;
30
+
ERROR HY000: Activation (AT) time is in the past
31
+
create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t;
32
+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'starts 10000101000000 do drop table t' at line 1
33
+
create event e_55 on schedule at 20200101000000 ends 10000101000000 do drop table t;
34
+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ends 10000101000000 do drop table t' at line 1
35
+
create event e_55 on schedule at 20200101000000 starts 10000101000000 ends 10000101000000 do drop table t;
36
+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'starts 10000101000000 ends 10000101000000 do drop table t' at line 1
37
+
create event e_55 on schedule every 10 hour starts 10000101000000 do drop table t;
"Now if everything is fine the event has compiled and is locked
42
53
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
43
54
user host db command state info
44
-
event_scheduler localhost NULL Connect Waiting for next activation NULL
55
+
event_scheduler localhost NULL Daemon Waiting for next activation NULL
45
56
root localhost events_test Connect User lock select get_lock('test_bug16407', 60)
46
57
select release_lock('test_bug16407');
47
58
release_lock('test_bug16407')
@@ -57,13 +68,19 @@ select event_schema, event_name, sql_mode from information_schema.events order b
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
96
110
user host db command state info
97
-
event_scheduler localhost NULL Connect Waiting for next activation NULL
111
+
event_scheduler localhost NULL Daemon Waiting for next activation NULL
98
112
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_2*/
99
113
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_3*/
100
114
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_4*/
@@ -103,7 +117,7 @@ release_lock('ee_16407_2')
103
117
1
104
118
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
105
119
user host db command state info
106
-
event_scheduler localhost NULL Connect Waiting for next activation NULL
120
+
event_scheduler localhost NULL Daemon Waiting for next activation NULL
107
121
set global event_scheduler= 2;
108
122
select * from events_smode_test order by ev_name, a;
109
123
ev_name a
@@ -121,28 +135,30 @@ drop event ee_16407_3;
121
135
drop event ee_16407_4;
122
136
"And now one last test regarding sql_mode and call of SP from an event"
123
137
delete from events_smode_test;
138
+
set sql_mode='ansi';
139
+
select get_lock('ee_16407_5', 60);
140
+
get_lock('ee_16407_5', 60)
141
+
1
142
+
set global event_scheduler= 1;
124
143
set sql_mode='traditional';
125
144
create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end|
126
145
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
127
146
create event ee_16407_5 on schedule every 60 second do
128
147
begin
129
148
select get_lock('ee_16407_5', 60) /*ee_16407_5*/;
149
+
select release_lock('ee_16407_5');
130
150
call events_test.ee_16407_5_pendant();
131
151
end|
132
152
create event ee_16407_6 on schedule every 60 second do
133
153
begin
134
154
select get_lock('ee_16407_5', 60) /*ee_16407_6*/;
155
+
select release_lock('ee_16407_5');
135
156
call events_test.ee_16407_6_pendant();
136
157
end|
137
-
set sql_mode='ansi';
138
-
select get_lock('ee_16407_5', 60);
139
-
get_lock('ee_16407_5', 60)
140
-
1
141
-
set global event_scheduler= 1;
142
158
"Should have 2 locked processes"
143
159
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
144
160
user host db command state info
145
-
event_scheduler localhost NULL Connect Waiting for next activation NULL
161
+
event_scheduler localhost NULL Daemon Waiting for next activation NULL
146
162
root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_5*/
147
163
root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_6*/
148
164
select release_lock('ee_16407_5');
@@ -151,7 +167,7 @@ release_lock('ee_16407_5')
151
167
"Should have 0 processes locked"
152
168
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
153
169
user host db command state info
154
-
event_scheduler localhost NULL Connect Waiting for next activation NULL
170
+
event_scheduler localhost NULL Daemon Waiting for next activation NULL
155
171
select * from events_smode_test order by ev_name, a;
--echo "Create an event which tries to acquire a mutex. The event locks on the mutex"
295
298
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
296
299
--echo "Let some time pass to the event starts"
297
-
--sleep 1
300
+
--sleep 0.5
298
301
--echo "Should have only 2 processes: the scheduler and the locked event"
299
302
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;--echo "Release the mutex, the event worker should finish."
300
303
--echo "Release the mutex, the event worker should finish."
@@ -312,10 +315,11 @@ drop event закачка;
312
315
set global event_scheduler=1;
313
316
select get_lock("test_lock2_1", 20);
314
317
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
315
-
--sleep 1
318
+
--sleep 0.5
316
319
--echo "Should have only 3 processes: the scheduler, our conn and the locked event"
317
320
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
318
321
set global event_scheduler=2;
322
+
--sleep 0.3
319
323
--echo "Should have only our process now:"
320
324
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
0 commit comments