Skip to content

Commit c6d81f8

Browse files
Matthias LeichMatthias Leich
Matthias Leich
authored and
Matthias Leich
committed
1. Fix for Bug#41111 events_bugs fails sporadically on pushbuild
2. Avoid bad effects of bug 41925 Warning 1366 Incorrect string value: ... for column processlist.info 3. Add poll routines which ensure that subtests meet stable scenarios. This does not change the sense of the subtests.
1 parent 33cbf93 commit c6d81f8

6 files changed

+339
-69
lines changed
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
########## include/check_events_off.inc ####################################
2+
# #
3+
# Purpose: #
4+
# Wait till we can expect that we have no event activity till the scheduler is #
5+
# switched on again. #
6+
# = There will be no modifications of user tables by existing events #
7+
# except they use "INSERT DELAYED" or the server system variable #
8+
# "concurrent_inserts" is not switched off. #
9+
# Only some storage engines support concurrent_inserts" or "INSERT DELAYED". #
10+
# #
11+
# Creation: #
12+
# 2008-12-19 mleich Implement this check needed for bug fixes in tests #
13+
# #
14+
################################################################################
15+
16+
# 1. Check that the server system variable shows the state needed
17+
if (`SELECT @@global.event_scheduler <> 'OFF'`)
18+
{
19+
--echo # Error: We expect here that the event scheduler is switched off.
20+
SELECT @@global.event_scheduler;
21+
--echo # Thinkable reasons:
22+
--echo # 1. SET GLOBAL event_scheduler = OFF had not the expected effect.
23+
--echo # 2. Use of the current routine (include/check_events_off.inc)
24+
--echo # within the wrong situation
25+
--die
26+
}
27+
# 2. Wait till we have no event_scheduler session within the processlist
28+
--source include/no_running_event_scheduler.inc
29+
# 3. Wait till we have no event executor sessions within the processlist
30+
--source include/no_running_events.inc
31+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
########## include/no_running_event_scheduler.inc ##########################
2+
# #
3+
# Wait till the event scheduler disappeared from processlist. #
4+
# #
5+
# The characteristics of the event_scheduler entry within the processlist is #
6+
# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if #
7+
# ther is no short phase with command <> 'Daemon'. #
8+
# A query with WHERE user = 'event_scheduler' only will also catch events in #
9+
# startup phase. This is no problem since this phase is very short. #
10+
# #
11+
# A wait_timeout of >= 3 seconds was within experiments sufficient even on a #
12+
# testing box with heavy parallel load. Therefore 5 seconds should be enough. #
13+
# #
14+
# Creation: #
15+
# 2008-12-19 mleich Implement this check needed for test bug fixes #
16+
# #
17+
################################################################################
18+
19+
let $wait_timeout= 5;
20+
let $wait_condition=
21+
SELECT COUNT(*) = 0 FROM information_schema.processlist
22+
WHERE user = 'event_scheduler';
23+
--source include/wait_condition.inc
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
########## include/no_running_events.inc ###################################
2+
# #
3+
# Wait till all event executors have finished their work. #
4+
# #
5+
# Different event executors share the characteristics that their entry within #
6+
# processlist contains command = 'Connect'. #
7+
# Of course the corresponding query will also catch other connections being #
8+
# within the connect phase. This is no problem since the connect phase is #
9+
# usually very short. #
10+
# #
11+
# A wait_timeout of >= 3 seconds was during experiments in case of "simple" #
12+
# SQL commands sufficient even on a testing box with heavy parallel load. #
13+
# "simple" = no sleeps, no long running commands, no waiting for lock ... #
14+
# We use here the default of 30 seconds because this wastes some time only in #
15+
# case of unexpected situations. #
16+
# #
17+
# Creation: #
18+
# 2008-12-19 mleich Implement this check needed for test bug fixes #
19+
# #
20+
################################################################################
21+
22+
let $wait_condition=
23+
SELECT COUNT(*) = 0 FROM information_schema.processlist
24+
WHERE command = 'Connect';
25+
--source include/wait_condition.inc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
############# include/running_event_scheduler.inc ##########################
2+
# #
3+
# Wait till the event scheduler reached its final state within the processlist.#
4+
# #
5+
# The characteristics of the event_scheduler entry within the processlist is #
6+
# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if #
7+
# ther is no short phase with command <> 'Daemon'. #
8+
# A query with WHERE user = 'event_scheduler' only will also catch events in #
9+
# startup phase. #
10+
# #
11+
# Creation: #
12+
# 2008-12-19 mleich Implement this check needed for test bug fixes #
13+
# #
14+
################################################################################
15+
16+
# 1. Check that the server system variable shows the state needed
17+
if (`SELECT @@global.event_scheduler <> 'ON'`)
18+
{
19+
--echo # Error: We expect here that the event scheduler is switched on.
20+
SELECT @@global.event_scheduler;
21+
--echo # Thinkable reasons:
22+
--echo # 1. SET GLOBAL event_scheduler = ON had not the expected effect.
23+
--echo # 2. Use of the current routine (include/running_event_scheduler.inc)
24+
--echo # within the wrong situation
25+
--die
26+
}
27+
let $wait_condition=
28+
SELECT COUNT(*) = 1 FROM information_schema.processlist
29+
WHERE user = 'event_scheduler' AND command = 'Daemon';
30+
--source include/wait_condition.inc

mysql-test/r/events_bugs.result

+13-14
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ drop database if exists mysqltest_db1;
33
drop database if exists mysqltest_db2;
44
create database events_test;
55
use events_test;
6+
set @concurrent_insert= @@global.concurrent_insert;
7+
set @@global.concurrent_insert = 0;
68
select * from information_schema.global_variables where variable_name like 'event_scheduler';
79
VARIABLE_NAME VARIABLE_VALUE
810
EVENT_SCHEDULER ON
@@ -60,7 +62,7 @@ select get_lock('test_bug16407', 60);
6062
end|
6163
"Now if everything is fine the event has compiled and is locked"
6264
select /*1*/ user, host, db, info from information_schema.processlist
63-
where info = 'select get_lock(\'test_bug16407\', 60)';
65+
where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)';
6466
user host db info
6567
root localhost events_test select get_lock('test_bug16407', 60)
6668
select release_lock('test_bug16407');
@@ -84,15 +86,15 @@ get_lock('ee_16407_2', 60)
8486
set global event_scheduler= 1;
8587
"Another sql_mode test"
8688
set sql_mode="traditional";
87-
create table events_smode_test(ev_name char(10), a date) engine=myisam;
89+
create table events_smode_test(ev_name char(10), a date);
8890
"This should never insert something"
8991
create event ee_16407_2 on schedule every 60 second do
9092
begin
9193
select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
9294
select release_lock('ee_16407_2');
9395
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
9496
end|
95-
insert into events_smode_test values ('test','1980-19-02')|
97+
insert into events_test.events_smode_test values ('test','1980-19-02')|
9698
ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
9799
"This is ok"
98100
create event ee_16407_3 on schedule every 60 second do
@@ -116,7 +118,7 @@ events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_
116118
events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
117119
events_test ee_16407_4
118120
select /*2*/ user, host, db, info from information_schema.processlist
119-
where info = 'select get_lock(\'ee_16407_2\', 60)';
121+
where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
120122
user host db info
121123
root localhost events_test select get_lock('ee_16407_2', 60)
122124
root localhost events_test select get_lock('ee_16407_2', 60)
@@ -125,10 +127,10 @@ select release_lock('ee_16407_2');
125127
release_lock('ee_16407_2')
126128
1
127129
select /*3*/ user, host, db, info from information_schema.processlist
128-
where info = 'select get_lock(\'ee_16407_2\', 60)';
130+
where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
129131
user host db info
130132
set global event_scheduler= off;
131-
select * from events_smode_test order by ev_name, a;
133+
select * from events_test.events_smode_test order by ev_name, a;
132134
ev_name a
133135
ee_16407_3 1980-02-19
134136
ee_16407_3 1980-02-29
@@ -143,7 +145,7 @@ drop event ee_16407_2;
143145
drop event ee_16407_3;
144146
drop event ee_16407_4;
145147
"And now one last test regarding sql_mode and call of SP from an event"
146-
delete from events_smode_test;
148+
delete from events_test.events_smode_test;
147149
set sql_mode='ansi';
148150
select get_lock('ee_16407_5', 60);
149151
get_lock('ee_16407_5', 60)
@@ -166,22 +168,18 @@ call events_test.ee_16407_6_pendant();
166168
end|
167169
"Should have 2 locked processes"
168170
select /*4*/ user, host, db, info from information_schema.processlist
169-
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
170-
order by info;
171+
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
171172
user host db info
172-
event_scheduler localhost NULL NULL
173173
root localhost events_test select get_lock('ee_16407_5', 60)
174174
root localhost events_test select get_lock('ee_16407_5', 60)
175175
select release_lock('ee_16407_5');
176176
release_lock('ee_16407_5')
177177
1
178178
"Should have 0 processes locked"
179179
select /*5*/ user, host, db, info from information_schema.processlist
180-
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
181-
order by info;
180+
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
182181
user host db info
183-
event_scheduler localhost NULL NULL
184-
select * from events_smode_test order by ev_name, a;
182+
select * from events_test.events_smode_test order by ev_name, a;
185183
ev_name a
186184
ee_16407_6 2004-02-29
187185
"And here we check one more time before we drop the events"
@@ -740,3 +738,4 @@ name
740738
drop event e1;
741739
DROP DATABASE events_test;
742740
SET GLOBAL event_scheduler = 'ON';
741+
SET @@global.concurrent_insert = @concurrent_insert;

0 commit comments

Comments
 (0)