Commit e21d0cf2 authored by unknown's avatar unknown
Browse files

Merge bk-internal:/home/bk/mysql-5.1-new

into  shellback.(none):/home/msvensson/mysql/mysql-5.1

parents efefe651 261a42b8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1770,3 +1770,4 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
libmysqld/event_scheduler.cc
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
	spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
	sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
	parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
	event_executor.cc event.cc event_timed.cc \
	event_scheduler.cc event.cc event_timed.cc \
	rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
	sql_tablespace.cc \
	rpl_injector.cc my_user.c partition_info.cc
+25 −27
Original line number Diff line number Diff line
@@ -17,13 +17,13 @@ db_x
SHOW TABLES FROM db_x;
Tables_in_db_x
x_table
SET GLOBAL event_scheduler=0;
SET GLOBAL event_scheduler=2;
DROP EVENT e_x1;
DROP EVENT e_x2;
DROP DATABASE db_x;
DROP USER pauline@localhost;
USE events_test;
SET GLOBAL event_scheduler=0;
SET GLOBAL event_scheduler=2;
drop event if exists event1;
Warnings:
Note	1305	Event event1 does not exist
@@ -100,7 +100,7 @@ a
800219
drop event non_qualif_ev;
drop table non_qualif;
set global event_scheduler = 0;
set global event_scheduler = 2;
create table t_event3 (a int, b float);
drop event if exists event3;
Warnings:
@@ -324,18 +324,18 @@ events_test one_event ev_test@localhost RECURRING NULL 20 SECOND # # ENABLED
events_test	three_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
events_test	two_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
"This should show us only 3 events:";
SHOW FULL EVENTS;
SHOW EVENTS;
Db	Name	Definer	Type	Execute at	Interval value	Interval field	Starts	Ends	Status
events_test	one_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
events_test	three_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
events_test	two_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
"This should show us only 2 events:";
SHOW FULL EVENTS LIKE 't%event';
SHOW EVENTS LIKE 't%event';
Db	Name	Definer	Type	Execute at	Interval value	Interval field	Starts	Ends	Status
events_test	three_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
events_test	two_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
"This should show us no events:";
SHOW FULL EVENTS FROM test LIKE '%';
SHOW EVENTS FROM test LIKE '%';
Db	Name	Definer	Type	Execute at	Interval value	Interval field	Starts	Ends	Status
DROP DATABASE events_test2;
"should see 1 event:";
@@ -343,11 +343,8 @@ SHOW EVENTS;
Db	Name	Definer	Type	Execute at	Interval value	Interval field	Starts	Ends	Status
events_test	one_event	root@localhost	RECURRING	NULL	10	SECOND	#	#	ENABLED
"we should see 4 events now:";
SHOW FULL EVENTS;
SHOW EVENTS;
Db	Name	Definer	Type	Execute at	Interval value	Interval field	Starts	Ends	Status
events_test	one_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
events_test	three_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
events_test	two_event	ev_test@localhost	RECURRING	NULL	20	SECOND	#	#	ENABLED
events_test	one_event	root@localhost	RECURRING	NULL	10	SECOND	#	#	ENABLED
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;
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	EVENT_BODY	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	STATUS	ON_COMPLETION	EVENT_COMMENT
@@ -373,12 +370,12 @@ 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;
set event_scheduler=2;
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'
set global event_scheduler=3;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '3'
"DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=0;
set global event_scheduler=2;
select definer, name, db from mysql.event;
definer	name	db
select get_lock("test_lock1", 20);
@@ -389,9 +386,10 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
select definer, name, db from mysql.event;
definer	name	db
root@localhost	закачка	events_test
"Should be 0 processes"
"Should be only 1 process"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user	host	db	command	state	info
event_scheduler	localhost	NULL	Connect	Suspended	NULL
select release_lock("test_lock1");
release_lock("test_lock1")
1
@@ -409,11 +407,12 @@ get_lock("test_lock2", 20)
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 2 processes: the scheduler and the locked event"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user	host	db	command	state	info
event_scheduler	localhost	NULL	Connect	Sleeping	NULL
root	localhost	events_test	Connect	User lock	select get_lock("test_lock2", 20)
"Release the mutex, the event worker should finish."
"Release the mutex, the event worker should finish."
select release_lock("test_lock2");
release_lock("test_lock2")
1
@@ -423,21 +422,17 @@ 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 1 process, locked on get_lock("
"Shutting down the scheduler, it should wait for the running event"
set global event_scheduler=0;
"Should have only 2 processes: the scheduler and the locked event"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
"Should have only 3 processes: the scheduler, our conn and the locked event"
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user	host	db	command	state	info
event_scheduler	localhost	NULL	Connect	Sleeping	NULL
root	localhost	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 see 0 processes now:"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
set global event_scheduler=2;
"Should have only our process now:"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user	host	db	command	state	info
event_scheduler	localhost	NULL	Connect	Suspended	NULL
root	localhost	events_test	Connect	User lock	select get_lock("test_lock2_1", 20)
drop event закачка21;
create table t_16 (s1 int);
create trigger t_16_bi before insert on t_16 for each row create event  e_16 on schedule every 1 second do set @a=5;
@@ -457,6 +452,9 @@ select 2;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
event_schema	event_name	definer	event_body
events_test	white_space	root@localhost	select 2
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
event_schema	event_name	definer	event_body
events_test	white_space	root@localhost	select 2
drop event white_space;
create event white_space on schedule every 10 hour disable do	select 3;
select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space';
+4 −4
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ create event e_55 on schedule every 10 hour starts 99990101000000 do drop table
ERROR HY000: Incorrect STARTS value: '99990101000000'
create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
ERROR HY000: ENDS is either invalid or before STARTS
set global event_scheduler=0;
set global event_scheduler=2;
"Wait a bit to settle down"
delete from mysql.event;
set global event_scheduler= 1;
@@ -57,7 +57,7 @@ root localhost events_test Connect User lock select get_lock('test_bug16407', 60
select release_lock('test_bug16407');
release_lock('test_bug16407')
1
set global event_scheduler= 0;
set global event_scheduler= 2;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
event_schema	event_name	sql_mode
events_test	e_16407	REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
@@ -115,7 +115,7 @@ release_lock('ee_16407_2')
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user	host	db	command	state	info
event_scheduler	localhost	NULL	Connect	Sleeping	NULL
set global event_scheduler= 0;
set global event_scheduler= 2;
select * from events_smode_test order by ev_name, a;
ev_name	a
ee_16407_3	1980-02-19
@@ -175,7 +175,7 @@ drop event ee_16407_5;
drop event ee_16407_6;
drop procedure ee_16407_5_pendant;
drop procedure ee_16407_6_pendant;
set global event_scheduler= 0;
set global event_scheduler= 2;
drop table events_smode_test;
set sql_mode=@old_sql_mode;
drop database events_test;
+12 −11
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ BEGIN
SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
END|
"Check General Query Log"
SET GLOBAL event_scheduler=0;
SET GLOBAL event_scheduler=2;
create event log_general on schedule every 1 minute do SELect 'alabala', sleep(3) from dual;
TRUNCATE mysql.general_log;
"1 row, the current statement!"
@@ -22,7 +22,7 @@ user_host argument
root[root] @ localhost [localhost]	SELect 'alabala', sleep(3) from dual
DROP PROCEDURE select_general_log;
DROP EVENT log_general;
SET GLOBAL event_scheduler=0;
SET GLOBAL event_scheduler=2;
"Check slow query log"
"Save the values"
SET @old_global_long_query_time:=(select get_value());
@@ -36,14 +36,14 @@ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host	query_time	db	sql_text
"Set new values"
SET GLOBAL long_query_time=4;
SET SESSION long_query_time=2;
SET SESSION long_query_time=1;
"Check that logging is working"
SELECT SLEEP(3);
SLEEP(3)
SELECT SLEEP(2);
SLEEP(2)
0
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host	query_time	db	sql_text
root[root] @ localhost []	SLEEPVAL	events_test	SELECT SLEEP(3)
root[root] @ localhost []	SLEEPVAL	events_test	SELECT SLEEP(2)
TRUNCATE mysql.slow_log;
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
"This won't go to the slow log"
@@ -54,7 +54,7 @@ SET GLOBAL event_scheduler=1;
"Sleep some more time than the actual event run will take"
SHOW VARIABLES LIKE 'event_scheduler';
Variable_name	Value
event_scheduler	ON
event_scheduler	1
"Check our table. Should see 1 row"
SELECT * FROM slow_event_test;
slo_val	val
@@ -64,18 +64,19 @@ SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host	query_time	db	sql_text
"This should go to the slow log"
SET SESSION long_query_time=10;
SET GLOBAL long_query_time=1;
DROP EVENT long_event;
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5);
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
"Sleep some more time than the actual event run will take"
"Check our table. Should see 2 rows"
SELECT * FROM slow_event_test;
slo_val	val
4	0
4	0
"Check slow log. Should see 1 row because 5 is over the threshold of 4 for GLOBAL, though under SESSION which is 10"
1	0
"Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10"
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
user_host	query_time	db	sql_text
root[root] @ localhost [localhost]	SLEEPVAL	events_test	INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(5)
root[root] @ localhost [localhost]	SLEEPVAL	events_test	INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2)
DROP EVENT long_event2;
SET GLOBAL  long_query_time =@old_global_long_query_time;
SET SESSION long_query_time =@old_session_long_query_time;
Loading