Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
08892be3
Commit
08892be3
authored
Jan 30, 2006
by
andrey@lmy004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post-merge fixes of fix for bug#16642 (No I_S.EVENTS table)
WL#1034 (Internal CRON)
parent
9d7d8767
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
116 deletions
+37
-116
mysql-test/r/events.result
mysql-test/r/events.result
+25
-106
mysql-test/r/system_mysql_db.result
mysql-test/r/system_mysql_db.result
+1
-1
mysql-test/t/events.test
mysql-test/t/events.test
+9
-9
sql/event_timed.cc
sql/event_timed.cc
+2
-0
No files found.
mysql-test/r/events.result
View file @
08892be3
...
@@ -34,29 +34,13 @@ create table t_event3 (a int, b float);
...
@@ -34,29 +34,13 @@ create table t_event3 (a int, b float);
drop event if exists event3;
drop event if exists event3;
Warnings:
Warnings:
Note 1305 Event event3 does not exist
Note 1305 Event event3 does not exist
create event event3 on schedule every 50 + 10 minute starts date_add("20
01
0101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
create event event3 on schedule every 50 + 10 minute starts date_add("20
10
0101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
set max_allowed_packet=128000000;
set max_allowed_packet=128000000;
select count(*) from t_event3;
select count(*) from t_event3;
count(*)
count(*)
0
0
drop event event3;
drop event event3;
drop table t_event3;
drop table t_event3;
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
events_test e_26 set @a = 5 root@localhost 2017-01-01 00:00:00 DROP
drop event e_26;
create event e_26 on schedule at NULL disabled do set @a = 5;
ERROR HY000: Incorrect AT value: 'NULL'
create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
ERROR HY000: Incorrect AT value: 'definitely not a datetime'
set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка;
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'
create event one_event on schedule every 10 second do select 123;
create event one_event on schedule every 10 second do select 123;
SHOW EVENTS;
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
...
@@ -81,15 +65,11 @@ Grants for ev_test@localhost
...
@@ -81,15 +65,11 @@ Grants for ev_test@localhost
GRANT USAGE ON *.* TO 'ev_test'@'localhost'
GRANT USAGE ON *.* TO 'ev_test'@'localhost'
GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost'
GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `events_test2`.* TO 'ev_test'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `events_test2`.* TO 'ev_test'@'localhost'
select "Here comes an error:";
"Here comes an error:";
Here comes an error:
Here comes an error:
SHOW EVENTS;
SHOW EVENTS;
ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2'
ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2'
USE events_test;
USE events_test;
select "Now the list should be empty:";
"Now the list should be empty:";
Now the list should be empty:
Now the list should be empty:
SHOW EVENTS;
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
select concat("Let's create some new events from the name of ",user());
select concat("Let's create some new events from the name of ",user());
...
@@ -98,44 +78,32 @@ Let's create some new events from the name of ev_test@localhost
...
@@ -98,44 +78,32 @@ Let's create some new events from the name of ev_test@localhost
create event one_event on schedule every 20 second do select 123;
create event one_event on schedule every 20 second do select 123;
create event two_event on schedule every 20 second on completion not preserve comment "two event" do select 123;
create event two_event on schedule every 20 second on completion not preserve comment "two event" do select 123;
create event three_event on schedule every 20 second on completion preserve comment "three event" do select 123;
create event three_event on schedule every 20 second on completion preserve comment "three event" do select 123;
select "Now we should see 3 events:";
"Now we should see 3 events:";
Now we should see 3 events:
Now we should see 3 events:
SHOW EVENTS;
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test one_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
select "This should show us only 3 events:";
"This should show us only 3 events:";
This should show us only 3 events:
This should show us only 3 events:
SHOW FULL EVENTS;
SHOW FULL EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test one_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
select "This should show us only 2 events:";
"This should show us only 2 events:";
This should show us only 2 events:
This should show us only 2 events:
SHOW FULL EVENTS LIKE 't%event';
SHOW FULL EVENTS LIKE 't%event';
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test three_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test three_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test two_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
select "This should show us no events:";
"This should show us no events:";
This should show us no events:
This should show us no events:
SHOW FULL EVENTS FROM test LIKE '%';
SHOW FULL EVENTS FROM test LIKE '%';
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
DROP DATABASE events_test2;
DROP DATABASE events_test2;
select "should see 1 event:";
"should see 1 event:";
should see 1 event:
should see 1 event:
SHOW EVENTS;
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event root@localhost RECURRING NULL 10 INTERVAL_SECOND # # ENABLED
events_test one_event root@localhost RECURRING NULL 10 INTERVAL_SECOND # # ENABLED
select "we should see 4 events now:";
"we should see 4 events now:";
we should see 4 events now:
we should see 4 events now:
SHOW FULL EVENTS;
SHOW FULL EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test one_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
events_test one_event ev_test@localhost RECURRING NULL 20 INTERVAL_SECOND # # ENABLED
...
@@ -153,69 +121,20 @@ drop event two_event;
...
@@ -153,69 +121,20 @@ drop event two_event;
drop event three_event;
drop event three_event;
drop user ev_test@localhost;
drop user ev_test@localhost;
drop event one_event;
drop event one_event;
set global event_scheduler=0;
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select count(*) from mysql.event;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
count(*)
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
0
events_test e_26 set @a = 5 root@localhost 2017-01-01 00:00:00 DROP
select get_lock("test_lock1", 20);
drop event e_26;
get_lock("test_lock1", 20)
create event e_26 on schedule at NULL disabled do set @a = 5;
1
ERROR HY000: Incorrect AT value: 'NULL'
create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
select count(*) from mysql.event;
ERROR HY000: Incorrect AT value: 'definitely not a datetime'
count(*)
set names utf8;
1
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
select release_lock("test_lock1");
drop event задачка;
release_lock("test_lock1")
set event_scheduler=0;
1
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
drop event закачка;
set global event_scheduler=2;
select count(*) from mysql.event;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
count(*)
0
set global event_scheduler=1;
select get_lock("test_lock2", 20);
get_lock("test_lock2", 20)
1
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
select sleep(2);
sleep(2)
0
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);
select sleep(2);
sleep(2)
0
set global event_scheduler=0;
select sleep(2);
sleep(2)
0
select release_lock("test_lock2_1");
release_lock("test_lock2_1")
1
select sleep(2);
sleep(2)
0
drop event закачка21;
set global event_scheduler=1;
select get_lock("test_lock3", 20);
get_lock("test_lock3", 20)
1
create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
select sleep(2);
sleep(2)
0
drop event закачка;
select release_lock("test_lock3");
release_lock("test_lock3")
1
set global event_scheduler=0;
select sleep(2);
sleep(2)
0
drop database events_test;
drop database events_test;
mysql-test/r/system_mysql_db.result
View file @
08892be3
...
@@ -204,7 +204,7 @@ event CREATE TABLE `event` (
...
@@ -204,7 +204,7 @@ event CREATE TABLE `event` (
`status` enum('ENABLED','DISABLED') NOT NULL default 'ENABLED',
`status` enum('ENABLED','DISABLED') NOT NULL default 'ENABLED',
`on_completion` enum('DROP','PRESERVE') NOT NULL default 'DROP',
`on_completion` enum('DROP','PRESERVE') NOT NULL default 'DROP',
`comment` char(64) character set utf8 collate utf8_bin NOT NULL default '',
`comment` char(64) character set utf8 collate utf8_bin NOT NULL default '',
PRIMARY KEY (`db`,`name`)
PRIMARY KEY (`d
efiner`,`d
b`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show create table general_log;
show create table general_log;
Table Create Table
Table Create Table
...
...
mysql-test/t/events.test
View file @
08892be3
...
@@ -27,7 +27,7 @@ set global event_scheduler = 0;
...
@@ -27,7 +27,7 @@ set global event_scheduler = 0;
create
table
t_event3
(
a
int
,
b
float
);
create
table
t_event3
(
a
int
,
b
float
);
drop
event
if
exists
event3
;
drop
event
if
exists
event3
;
create
event
event3
on
schedule
every
50
+
10
minute
starts
date_add
(
"20
01
0101"
,
interval
5
minute
)
ends
date_add
(
"20151010"
,
interval
5
day
)
comment
"portokala_comment"
DO
insert
into
t_event3
values
(
unix_timestamp
(),
rand
());
create
event
event3
on
schedule
every
50
+
10
minute
starts
date_add
(
"20
10
0101"
,
interval
5
minute
)
ends
date_add
(
"20151010"
,
interval
5
day
)
comment
"portokala_comment"
DO
insert
into
t_event3
values
(
unix_timestamp
(),
rand
());
set
max_allowed_packet
=
128000000
;
set
max_allowed_packet
=
128000000
;
select
count
(
*
)
from
t_event3
;
select
count
(
*
)
from
t_event3
;
drop
event
event3
;
drop
event
event3
;
...
@@ -52,13 +52,13 @@ select "NEW CONNECTION";
...
@@ -52,13 +52,13 @@ select "NEW CONNECTION";
SELECT
USER
(),
DATABASE
();
SELECT
USER
(),
DATABASE
();
SHOW
GRANTS
;
SHOW
GRANTS
;
select
"Here comes an error:"
;
--
echo
"Here comes an error:"
;
#NO EVENT_ACL on events_test2
#NO EVENT_ACL on events_test2
--
error
1044
--
error
1044
SHOW
EVENTS
;
SHOW
EVENTS
;
USE
events_test
;
USE
events_test
;
select
"Now the list should be empty:"
;
--
echo
"Now the list should be empty:"
;
--
replace_column
8
# 9 #
--
replace_column
8
# 9 #
SHOW
EVENTS
;
SHOW
EVENTS
;
#now create an event with the same name but we are different user
#now create an event with the same name but we are different user
...
@@ -67,30 +67,30 @@ create event one_event on schedule every 20 second do select 123;
...
@@ -67,30 +67,30 @@ create event one_event on schedule every 20 second do select 123;
create
event
two_event
on
schedule
every
20
second
on
completion
not
preserve
comment
"two event"
do
select
123
;
create
event
two_event
on
schedule
every
20
second
on
completion
not
preserve
comment
"two event"
do
select
123
;
create
event
three_event
on
schedule
every
20
second
on
completion
preserve
comment
"three event"
do
select
123
;
create
event
three_event
on
schedule
every
20
second
on
completion
preserve
comment
"three event"
do
select
123
;
select
"Now we should see 3 events:"
;
--
echo
"Now we should see 3 events:"
;
--
replace_column
8
# 9 #
--
replace_column
8
# 9 #
SHOW
EVENTS
;
SHOW
EVENTS
;
select
"This should show us only 3 events:"
;
--
echo
"This should show us only 3 events:"
;
--
replace_column
8
# 9 #
--
replace_column
8
# 9 #
SHOW
FULL
EVENTS
;
SHOW
FULL
EVENTS
;
select
"This should show us only 2 events:"
;
--
echo
"This should show us only 2 events:"
;
--
replace_column
8
# 9 #
--
replace_column
8
# 9 #
SHOW
FULL
EVENTS
LIKE
't%event'
;
SHOW
FULL
EVENTS
LIKE
't%event'
;
select
"This should show us no events:"
;
--
echo
"This should show us no events:"
;
--
replace_column
8
# 9 #
--
replace_column
8
# 9 #
SHOW
FULL
EVENTS
FROM
test
LIKE
'%'
;
SHOW
FULL
EVENTS
FROM
test
LIKE
'%'
;
#ok, we are back
#ok, we are back
connection
default
;
connection
default
;
DROP
DATABASE
events_test2
;
DROP
DATABASE
events_test2
;
select
"should see 1 event:"
;
--
echo
"should see 1 event:"
;
--
replace_column
8
# 9 #
--
replace_column
8
# 9 #
SHOW
EVENTS
;
SHOW
EVENTS
;
select
"we should see 4 events now:"
;
--
echo
"we should see 4 events now:"
;
--
replace_column
8
# 9 #
--
replace_column
8
# 9 #
SHOW
FULL
EVENTS
;
SHOW
FULL
EVENTS
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
from
information_schema
.
events
;
SELECT
EVENT_CATALOG
,
EVENT_SCHEMA
,
EVENT_NAME
,
DEFINER
,
EVENT_BODY
,
EVENT_TYPE
,
EXECUTE_AT
,
INTERVAL_VALUE
,
INTERVAL_FIELD
,
STATUS
,
ON_COMPLETION
,
EVENT_COMMENT
from
information_schema
.
events
;
...
...
sql/event_timed.cc
View file @
08892be3
...
@@ -307,6 +307,8 @@ event_timed::init_starts(THD *thd, Item *new_starts)
...
@@ -307,6 +307,8 @@ event_timed::init_starts(THD *thd, Item *new_starts)
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
time_tmp
,
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
time_tmp
,
(
my_time_t
)
thd
->
query_start
());
(
my_time_t
)
thd
->
query_start
());
DBUG_PRINT
(
"info"
,(
"now =%lld"
,
TIME_to_ulonglong_datetime
(
&
time_tmp
)));
DBUG_PRINT
(
"info"
,(
"starts=%lld"
,
TIME_to_ulonglong_datetime
(
&
ltime
)));
if
(
TIME_to_ulonglong_datetime
(
&
ltime
)
<
if
(
TIME_to_ulonglong_datetime
(
&
ltime
)
<
TIME_to_ulonglong_datetime
(
&
time_tmp
))
TIME_to_ulonglong_datetime
(
&
time_tmp
))
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
DBUG_RETURN
(
EVEX_BAD_PARAMS
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment