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
aa1c4d4e
Commit
aa1c4d4e
authored
Nov 25, 2008
by
Matthias Leich
Browse files
Options
Browse Files
Download
Plain Diff
Merge fix for bug 39854 into GCA tree
parents
d4954920
f572b81a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
15 deletions
+27
-15
mysql-test/r/events_scheduling.result
mysql-test/r/events_scheduling.result
+5
-4
mysql-test/t/events_scheduling.test
mysql-test/t/events_scheduling.test
+22
-11
No files found.
mysql-test/r/events_scheduling.result
View file @
aa1c4d4e
CREATE DATABASE IF NOT EXISTS events_test;
CREATE DATABASE IF NOT EXISTS events_test;
USE events_test;
USE events_test;
SET @event_scheduler=@@global.event_scheduler;
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
Try ag
ia
n to make sure it's allowed
Try ag
ai
n to make sure it's allowed
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE 'event_scheduler';
SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value
Variable_name Value
...
@@ -64,8 +65,8 @@ INSERT INTO table_4 VALUES (1);
...
@@ -64,8 +65,8 @@ INSERT INTO table_4 VALUES (1);
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
IF(SUM(a) >= 4, 'OK', 'ERROR')
IF(SUM(a) >= 4, 'OK', 'ERROR')
OK
OK
SELECT IF(SUM(a) >=
5
, 'OK', 'ERROR') FROM table_2;
SELECT IF(SUM(a) >=
4
, 'OK', 'ERROR') FROM table_2;
IF(SUM(a) >=
5
, 'OK', 'ERROR')
IF(SUM(a) >=
4
, 'OK', 'ERROR')
OK
OK
SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
IF(SUM(a) >= 1, 'OK', 'ERROR')
IF(SUM(a) >= 1, 'OK', 'ERROR')
...
@@ -94,4 +95,4 @@ DROP TABLE table_2;
...
@@ -94,4 +95,4 @@ DROP TABLE table_2;
DROP TABLE table_3;
DROP TABLE table_3;
DROP TABLE table_4;
DROP TABLE table_4;
DROP DATABASE events_test;
DROP DATABASE events_test;
SET GLOBAL event_scheduler=
OFF
;
SET GLOBAL event_scheduler=
@event_scheduler
;
mysql-test/t/events_scheduling.test
View file @
aa1c4d4e
# Can't test with embedded server that doesn't support
gra
nts
# Can't test with embedded server that doesn't support
eve
nts
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
CREATE
DATABASE
IF
NOT
EXISTS
events_test
;
CREATE
DATABASE
IF
NOT
EXISTS
events_test
;
USE
events_test
;
USE
events_test
;
SET
@
event_scheduler
=@@
global
.
event_scheduler
;
SET
GLOBAL
event_scheduler
=
OFF
;
SET
GLOBAL
event_scheduler
=
OFF
;
--
echo
Try
ag
ia
n
to
make
sure
it
's allowed
--
echo
Try
ag
ai
n
to
make
sure
it
's allowed
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE '
event_scheduler
';
SHOW VARIABLES LIKE '
event_scheduler
';
SET GLOBAL event_scheduler=1;
SET GLOBAL event_scheduler=1;
...
@@ -57,14 +58,22 @@ ON COMPLETION PRESERVE
...
@@ -57,14 +58,22 @@ ON COMPLETION PRESERVE
DO
DO
INSERT
INTO
table_4
VALUES
(
1
);
INSERT
INTO
table_4
VALUES
(
1
);
# Wait for the events to fire and check the data afterwards
# Let event_1 insert at least 4 records into the table
# Let event_1 insert at least 4 records into the table
let
$wait_condition
=
select
count
(
*
)
>=
4
from
table_1
;
let
$wait_condition
=
select
count
(
*
)
>=
4
from
table_1
;
--
source
include
/
wait_condition
.
inc
--
source
include
/
wait_condition
.
inc
# Minimum of passed time is 6 seconds assuming
# - event executions starts immediate after creation
# - 4 times event_1 means an insert at ect, ect+2, ect+4, ect+6
# ect = event creation time
# Let event_2 reach the end of its execution interval
# Let event_2 reach the end of its execution interval
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
where
event_name
=
'event_2'
and
status
=
'enabled'
;
where
event_name
=
'event_2'
and
status
=
'enabled'
;
--
source
include
/
wait_condition
.
inc
--
source
include
/
wait_condition
.
inc
# Minimum of passed time is 6 seconds.
# See wait_condition for event_1 above and ENDS condition for event_2.
# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
let
$wait_condition
=
select
count
(
*
)
=
0
from
information_schema
.
events
...
@@ -76,15 +85,17 @@ let $wait_condition=select count(*) = 0 from information_schema.events
...
@@ -76,15 +85,17 @@ let $wait_condition=select count(*) = 0 from information_schema.events
where
event_name
=
'event_4'
and
status
=
'enabled'
;
where
event_name
=
'event_4'
and
status
=
'enabled'
;
--
source
include
/
wait_condition
.
inc
--
source
include
/
wait_condition
.
inc
# Wait for the events to fire and check the data afterwards
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
4
FROM
table_1
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
4
FROM
table_1
;
source
include
/
wait_condition
.
inc
;
source
include
/
wait_condition
.
inc
;
SELECT
IF
(
SUM
(
a
)
>=
4
,
'OK'
,
'ERROR'
)
FROM
table_1
;
SELECT
IF
(
SUM
(
a
)
>=
4
,
'OK'
,
'ERROR'
)
FROM
table_1
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
5
FROM
table_2
;
# In case of a testing box under heavy load it cannot be guaranteed that
# it is really often enough checked if event_2 has to be executed.
# -> Bug#39854 events_scheduling fails sporadically on pushbuild
# Therefore we lowered here the original expectation of 5 to 4.
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
4
FROM
table_2
;
source
include
/
wait_condition
.
inc
;
source
include
/
wait_condition
.
inc
;
SELECT
IF
(
SUM
(
a
)
>=
5
,
'OK'
,
'ERROR'
)
FROM
table_2
;
SELECT
IF
(
SUM
(
a
)
>=
4
,
'OK'
,
'ERROR'
)
FROM
table_2
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
1
FROM
table_3
;
let
$wait_condition
=
SELECT
SUM
(
a
)
>=
1
FROM
table_3
;
source
include
/
wait_condition
.
inc
;
source
include
/
wait_condition
.
inc
;
...
@@ -112,7 +123,7 @@ DROP TABLE table_2;
...
@@ -112,7 +123,7 @@ DROP TABLE table_2;
DROP
TABLE
table_3
;
DROP
TABLE
table_3
;
DROP
TABLE
table_4
;
DROP
TABLE
table_4
;
DROP
DATABASE
events_test
;
DROP
DATABASE
events_test
;
SET
GLOBAL
event_scheduler
=
OFF
;
SET
GLOBAL
event_scheduler
=
@
event_scheduler
;
#
#
# End of tests
# End of tests
...
...
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