Commit ec1b0874 authored by Matthias Leich's avatar Matthias Leich

Merge into actual tree

parents 27a2c739 3bee9e6a
########## include/check_events_off.inc ####################################
# #
# Purpose: #
# Wait till we can expect that we have no event activity till the scheduler is #
# switched on again. #
# = There will be no modifications of user tables by existing events #
# except they use "INSERT DELAYED" or the server system variable #
# "concurrent_inserts" is not switched off. #
# Only some storage engines support concurrent_inserts" or "INSERT DELAYED". #
# #
# Creation: #
# 2008-12-19 mleich Implement this check needed for bug fixes in tests #
# #
################################################################################
# 1. Check that the server system variable shows the state needed
if (`SELECT @@global.event_scheduler <> 'OFF'`)
{
--echo # Error: We expect here that the event scheduler is switched off.
SELECT @@global.event_scheduler;
--echo # Thinkable reasons:
--echo # 1. SET GLOBAL event_scheduler = OFF had not the expected effect.
--echo # 2. Use of the current routine (include/check_events_off.inc)
--echo # within the wrong situation
--die
}
# 2. Wait till we have no event_scheduler session within the processlist
--source include/no_running_event_scheduler.inc
# 3. Wait till we have no event executor sessions within the processlist
--source include/no_running_events.inc
########## include/no_running_event_scheduler.inc ##########################
# #
# Wait till the event scheduler disappeared from processlist. #
# #
# The characteristics of the event_scheduler entry within the processlist is #
# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if #
# ther is no short phase with command <> 'Daemon'. #
# A query with WHERE user = 'event_scheduler' only will also catch events in #
# startup phase. This is no problem since this phase is very short. #
# #
# A wait_timeout of >= 3 seconds was within experiments sufficient even on a #
# testing box with heavy parallel load. Therefore 5 seconds should be enough. #
# #
# Creation: #
# 2008-12-19 mleich Implement this check needed for test bug fixes #
# #
################################################################################
let $wait_timeout= 5;
let $wait_condition=
SELECT COUNT(*) = 0 FROM information_schema.processlist
WHERE user = 'event_scheduler';
--source include/wait_condition.inc
########## include/no_running_events.inc ###################################
# #
# Wait till all event executors have finished their work. #
# #
# Different event executors share the characteristics that their entry within #
# processlist contains command = 'Connect'. #
# Of course the corresponding query will also catch other connections being #
# within the connect phase. This is no problem since the connect phase is #
# usually very short. #
# #
# A wait_timeout of >= 3 seconds was during experiments in case of "simple" #
# SQL commands sufficient even on a testing box with heavy parallel load. #
# "simple" = no sleeps, no long running commands, no waiting for lock ... #
# We use here the default of 30 seconds because this wastes some time only in #
# case of unexpected situations. #
# #
# Creation: #
# 2008-12-19 mleich Implement this check needed for test bug fixes #
# #
################################################################################
let $wait_condition=
SELECT COUNT(*) = 0 FROM information_schema.processlist
WHERE command = 'Connect';
--source include/wait_condition.inc
############# include/running_event_scheduler.inc ##########################
# #
# Wait till the event scheduler reached its final state within the processlist.#
# #
# The characteristics of the event_scheduler entry within the processlist is #
# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if #
# ther is no short phase with command <> 'Daemon'. #
# A query with WHERE user = 'event_scheduler' only will also catch events in #
# startup phase. #
# #
# Creation: #
# 2008-12-19 mleich Implement this check needed for test bug fixes #
# #
################################################################################
# 1. Check that the server system variable shows the state needed
if (`SELECT @@global.event_scheduler <> 'ON'`)
{
--echo # Error: We expect here that the event scheduler is switched on.
SELECT @@global.event_scheduler;
--echo # Thinkable reasons:
--echo # 1. SET GLOBAL event_scheduler = ON had not the expected effect.
--echo # 2. Use of the current routine (include/running_event_scheduler.inc)
--echo # within the wrong situation
--die
}
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE user = 'event_scheduler' AND command = 'Daemon';
--source include/wait_condition.inc
......@@ -3,6 +3,8 @@ drop database if exists mysqltest_db1;
drop database if exists mysqltest_db2;
create database events_test;
use events_test;
set @concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert = 0;
select * from information_schema.global_variables where variable_name like 'event_scheduler';
VARIABLE_NAME VARIABLE_VALUE
EVENT_SCHEDULER ON
......@@ -60,7 +62,7 @@ select get_lock('test_bug16407', 60);
end|
"Now if everything is fine the event has compiled and is locked"
select /*1*/ user, host, db, info from information_schema.processlist
where info = 'select get_lock(\'test_bug16407\', 60)';
where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)';
user host db info
root localhost events_test select get_lock('test_bug16407', 60)
select release_lock('test_bug16407');
......@@ -84,7 +86,7 @@ get_lock('ee_16407_2', 60)
set global event_scheduler= 1;
"Another sql_mode test"
set sql_mode="traditional";
create table events_smode_test(ev_name char(10), a date) engine=myisam;
create table events_smode_test(ev_name char(10), a date);
"This should never insert something"
create event ee_16407_2 on schedule every 60 second do
begin
......@@ -92,7 +94,7 @@ select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
select release_lock('ee_16407_2');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
insert into events_smode_test values ('test','1980-19-02')|
insert into events_test.events_smode_test values ('test','1980-19-02')|
ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
"This is ok"
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_
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
events_test ee_16407_4
select /*2*/ user, host, db, info from information_schema.processlist
where info = 'select get_lock(\'ee_16407_2\', 60)';
where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
user host db info
root localhost events_test select get_lock('ee_16407_2', 60)
root localhost events_test select get_lock('ee_16407_2', 60)
......@@ -125,10 +127,10 @@ select release_lock('ee_16407_2');
release_lock('ee_16407_2')
1
select /*3*/ user, host, db, info from information_schema.processlist
where info = 'select get_lock(\'ee_16407_2\', 60)';
where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
user host db info
set global event_scheduler= off;
select * from events_smode_test order by ev_name, a;
select * from events_test.events_smode_test order by ev_name, a;
ev_name a
ee_16407_3 1980-02-19
ee_16407_3 1980-02-29
......@@ -143,7 +145,7 @@ drop event ee_16407_2;
drop event ee_16407_3;
drop event ee_16407_4;
"And now one last test regarding sql_mode and call of SP from an event"
delete from events_smode_test;
delete from events_test.events_smode_test;
set sql_mode='ansi';
select get_lock('ee_16407_5', 60);
get_lock('ee_16407_5', 60)
......@@ -166,10 +168,8 @@ call events_test.ee_16407_6_pendant();
end|
"Should have 2 locked processes"
select /*4*/ user, host, db, info from information_schema.processlist
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
order by info;
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
user host db info
event_scheduler localhost NULL NULL
root localhost events_test select get_lock('ee_16407_5', 60)
root localhost events_test select get_lock('ee_16407_5', 60)
select release_lock('ee_16407_5');
......@@ -177,11 +177,9 @@ release_lock('ee_16407_5')
1
"Should have 0 processes locked"
select /*5*/ user, host, db, info from information_schema.processlist
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
order by info;
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
user host db info
event_scheduler localhost NULL NULL
select * from events_smode_test order by ev_name, a;
select * from events_test.events_smode_test order by ev_name, a;
ev_name a
ee_16407_6 2004-02-29
"And here we check one more time before we drop the events"
......@@ -740,3 +738,4 @@ name
drop event e1;
DROP DATABASE events_test;
SET GLOBAL event_scheduler = 'ON';
SET @@global.concurrent_insert = @concurrent_insert;
SET @old_general_log= @@global.general_log;
SET @old_general_log_file= @@global.general_log_file;
SET @old_slow_query_log= @@global.slow_query_log;
SET @old_slow_query_log_file= @@global.slow_query_log_file;
set global general_log= OFF;
truncate table mysql.general_log;
truncate table mysql.slow_log;
......@@ -33,20 +37,26 @@ general_log ON
log ON
log_slow_queries OFF
slow_query_log OFF
set session long_query_time=1;
select sleep(2);
sleep(2)
# Establish connection con1 (user=root)
# Switch to connection con1
set @long_query_time = <long_query_time>;
set session long_query_time = @long_query_time;
select sleep(@long_query_time + 1);
sleep(@long_query_time + 1)
0
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
# Switch to connection default
set global slow_query_log= ON;
set session long_query_time=1;
select sleep(2);
sleep(2)
# Switch to connection con1
set session long_query_time = @long_query_time;
select sleep(@long_query_time + 1);
sleep(@long_query_time + 1)
0
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2)
TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(@long_query_time + 1)
# Switch to connection default
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
......@@ -92,8 +102,8 @@ slow_query_log_file #
show variables like 'log_output';
Variable_name Value
log_output FILE,TABLE
set global general_log_file='/not exiting path/log.master';
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
set global general_log_file='/not existing path/log.master';
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not existing path/log.master'
set global general_log_file='MYSQLTEST_VARDIR';
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR'
set global general_log_file='';
......@@ -153,8 +163,10 @@ select * from mysql.general_log;
event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST # 1 Query drop table t1
TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
FLUSH TABLES WITH READ LOCK;
......@@ -173,10 +185,9 @@ SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log;
SET GLOBAL general_log = ON;
SHOW VARIABLES LIKE 'general_log';
Variable_name Value
general_log ON
......@@ -239,29 +250,24 @@ log_slow_queries ON
SELECT @@slow_query_log, @@log_slow_queries;
@@slow_query_log @@log_slow_queries
1 1
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
set @old_general_log_file= @@global.general_log_file;
set @old_slow_query_log_file= @@global.slow_query_log_file;
set global general_log_file= concat('/not exiting path/log.maste', 'r');
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
set global general_log_file= NULL;
SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log;
SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r');
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not existing path/log.master'
SET GLOBAL general_log_file= NULL;
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'NULL'
set global slow_query_log_file= concat('/not exiting path/log.maste', 'r');
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not exiting path/log.master'
set global slow_query_log_file= NULL;
SET GLOBAL slow_query_log_file= CONCAT('/not existing path/log.maste', 'r');
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not existing path/log.master'
SET GLOBAL slow_query_log_file= NULL;
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'NULL'
set global general_log_file= @old_general_log_file;
set global slow_query_log_file= @old_slow_query_log_file;
SET GLOBAL general_log_file= @old_general_log_file;
SET GLOBAL slow_query_log_file= @old_slow_query_log_file;
# --
# -- Bug#32748: Inconsistent handling of assignments to
# -- general_log_file/slow_query_log_file.
# --
SET @general_log_file_saved = @@global.general_log_file;
SET @slow_query_log_file_saved = @@global.slow_query_log_file;
SET GLOBAL general_log_file = 'bug32748.query.log';
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
......@@ -270,8 +276,8 @@ Variable_name Value
general_log_file bug32748.query.log
slow_query_log_file bug32748.slow.log
SET GLOBAL general_log_file = @general_log_file_saved;
SET GLOBAL slow_query_log_file = @slow_query_log_file_saved;
SET GLOBAL general_log_file = @old_general_log_file;
SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
# -- End of Bug#32748.
deprecated:
......@@ -298,4 +304,13 @@ SET GLOBAL general_log_file = @my_glf;
SET GLOBAL slow_query_log_file = @my_sqlf;
SET GLOBAL general_log = DEFAULT;
SET GLOBAL slow_query_log = DEFAULT;
SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
End of 5.1 tests
# Close connection con1
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
SET global slow_query_log_file = @old_slow_query_log_file;
......@@ -65,12 +65,15 @@ CREATE TABLE t1(AFIELD INT);
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(GMT VARCHAR(32));
INSERT INTO t2 VALUES('GMT-0800');
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
FROM t1, t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800
INSERT INTO t1 VALUES(1);
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)),
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
FROM t1,t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800
drop table t1,t2;
CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
......@@ -155,7 +158,7 @@ str_to_date( '', a )
0000-00-00 00:00:00
NULL
DROP TABLE t1;
CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b));
CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b));
INSERT INTO t1 VALUES (DATE(NOW()), 1);
SELECT COUNT(*) FROM t1 WHERE a = NOW();
COUNT(*)
......
# suite/funcs_1/t/is_collation_character_set_applicability.test
# suite/funcs_1/t/is_coll_char_set_appl.test
#
# Check the layout of information_schema.collation_character_set_applicability
# and some functionality realted tests.
# and some functionality related tests.
#
# Author:
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
......
This diff is collapsed.
This diff is collapsed.
......@@ -75,9 +75,12 @@ CREATE TABLE t1(AFIELD INT);
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(GMT VARCHAR(32));
INSERT INTO t2 VALUES('GMT-0800');
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD;
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
FROM t1, t2 GROUP BY t1.AFIELD;
INSERT INTO t1 VALUES(1);
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD;
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)),
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
FROM t1,t2 GROUP BY t1.AFIELD;
drop table t1,t2;
#
......@@ -90,7 +93,7 @@ SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
DROP TABLE t1;
#
# Bug 4937: different date -> string conversion when using SELECT ... UNION
# Bug#4937: different date -> string conversion when using SELECT ... UNION
# and INSERT ... SELECT ... UNION
#
......@@ -141,7 +144,7 @@ select * from t1;
drop table t1;
#
# Bug #30942: select str_to_date from derived table returns varying results
# Bug#30942: select str_to_date from derived table returns varying results
#
CREATE TABLE t1 (
a INT
......@@ -155,10 +158,22 @@ DROP TABLE t1;
#
# Bug #31221: Optimizer incorrectly identifies impossible WHERE clause
# Bug#31221: Optimizer incorrectly identifies impossible WHERE clause
#
CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b));
CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b));
## The current sub test could fail (difference to expected result) if we
## have just reached midnight.
## (Bug#41776 type_date.test may fail if run around midnight)
## Therefore we sleep a bit if we are too close to midnight.
## The complete test itself needs in average less than 1 second.
## Therefore a time_distance to midnight of 5 seconds should be sufficient.
if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`)
{
# We are here when CURTIME() is between '23:59:56' and '23:59:59'.
# So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'.
--real_sleep 5
}
INSERT INTO t1 VALUES (DATE(NOW()), 1);
SELECT COUNT(*) FROM t1 WHERE a = NOW();
EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
......@@ -174,7 +189,7 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
DROP TABLE t1;
#
# Bug #28687: Search fails on '0000-00-00' date after sql_mode change
# Bug#28687: Search fails on '0000-00-00' date after sql_mode change
#
CREATE TABLE t1 (a DATE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment