mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge into actual tree
This commit is contained in:
@ -1,40 +1,133 @@
|
||||
#### t/events_bugs.test
|
||||
#
|
||||
# Last change:
|
||||
# 2008-10-16 mleich
|
||||
# 2009-01-08 mleich
|
||||
# - Fix for
|
||||
# Bug#39848 events_bugs fails sporadically on pushbuild
|
||||
# (missing rows in table event_log)
|
||||
# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes
|
||||
# in I_S.PROCESSLIST)
|
||||
# Bug#39978 main.events_bugs does not clean up
|
||||
# Bug#39569 events_bugs fails sporadically on pushbuild (should have
|
||||
# failed with errno 1539)
|
||||
# - Minor improvements of formatting
|
||||
# Bug#41111 events_bugs fails sporadically on pushbuild
|
||||
# - Avoid effects of
|
||||
# Bug#41925 Warning 1366 Incorrect string value: ... for column processlist.info
|
||||
#
|
||||
# Please set $
|
||||
let $fixed_bug41925= 0;
|
||||
#
|
||||
# Dear maintainer of this test. Please do NOT remove the next big comment.
|
||||
# The tests for events were quite unstable over a significant time because the
|
||||
# effects of events in general and their representation within the processlist
|
||||
# were partially not known. Therefore I had to make excessive experiments.
|
||||
# The comment with the outcome of these experiments will be moved into a README
|
||||
# file as soon as the tests for events get their own testsuite.
|
||||
#
|
||||
# Outcome of some experiments (mleich, mysql-5.1 2008-12):
|
||||
# --------------------------------------------------------
|
||||
# 0. Most time used setup:
|
||||
# High parallel I/O load
|
||||
# set global event_scheduler= off;
|
||||
# sleep 3;
|
||||
# use events_test;
|
||||
# create event e_16407 on schedule every 2 second do
|
||||
# begin
|
||||
# select 'FIRST COMMAND', sleep(0.5);
|
||||
# select 'SECOND COMMAND';
|
||||
# end|
|
||||
# set global event_scheduler= on;
|
||||
# Start observation of the processlist
|
||||
#
|
||||
#
|
||||
# 1. SET GLOBAL event_scheduler = 'ON' and immediate observation of the processlist.
|
||||
# 1.1 Effects around event scheduler:
|
||||
# 1.1.1 First phase (very short)
|
||||
# No user 'event_scheduler' within information_schema.processlist.
|
||||
# 1.1.2 Second phase observed (independend of probably existing events and very short) was
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# event_scheduler localhost NULL Daemon 0 Initialized NULL
|
||||
# 1.1.3 Third phase observed:
|
||||
# 1.1.3.1 Case we do not have existing events (rather long)
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# event_scheduler localhost NULL Daemon 0 Waiting on empty queue NULL
|
||||
# 1.1.3.2 Case there exists already an event
|
||||
# 1.1.3.2.1 Event executor is not visible in processlist but comes up soon
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# event_scheduler localhost NULL Daemon 0 NULL
|
||||
# or
|
||||
# event_scheduler localhost NULL Daemon 0 NULL NULL
|
||||
# 1.1.3.2.2 A bit later, at least one event executor is or was visible in processlist
|
||||
# The states mentioned in 3.2.1 or a bit later
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# event_scheduler localhost NULL Daemon 0 Waiting for next activation NULL
|
||||
# 1.2 Effects around event executor:
|
||||
# Typical processlist content:
|
||||
# USER evtest1 -- Definer of event
|
||||
# DB events_test -- DB during time of event creation (use DB is not allowed in events)
|
||||
# COMMAND Connect
|
||||
# STATE NULL
|
||||
# INFO SET @evname = 'ev_sched_1823' -- Part of the event code
|
||||
#
|
||||
# State before "User sleep select 'FIRST COMMAND', sleep(0.5);"
|
||||
# ID USER HOST DB COMMAND TIME STATE INFO
|
||||
# 7 event_scheduler localhost NULL Connect 0 NULL NULL
|
||||
# !! The user is not the event creator and the DB is different. !!
|
||||
# !! This means that we must get later a change of the identity. !!
|
||||
# or
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 checking permissions
|
||||
# or
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 checking permissions CREATE PROCEDURE ....
|
||||
# or
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 NULL select 'FIRST COMMAND', sleep(0.5)
|
||||
# or
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 checking permissions select 'FIRST COMMAND'...
|
||||
# or
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 Opening table select 'FIRST COMMAND', sleep(0.5)
|
||||
# or
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 Locked select 'FIRST COMMAND', sleep(0.5)
|
||||
# or
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 executing select 'FIRST COMMAND', sleep(0.5)
|
||||
#
|
||||
# State "User sleep select 'FIRST COMMAND', sleep(0.5);" reached
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 User sleep select 'FIRST COMMAND', sleep(0.5)
|
||||
#
|
||||
# State at end (! It looks like a slow CREATE PROC !) of event code execution was sometimes
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 logging slow query CREATE PROCEDURE `e_16407`...
|
||||
#
|
||||
# State after running some event code was sometimes
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# root localhost events_test Connect 0 logging slow query select 'SECOND COMMAND'
|
||||
#
|
||||
# State somewhere (I guess just before the event executor disappears)
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# Event thread fin <empty> events_test Connect 0 Clearing NULL
|
||||
#
|
||||
#
|
||||
# Outcome of some experiments (mleich):
|
||||
# 1. SET GLOBAL event_scheduler = 'ON';
|
||||
# Immediate observation of the processlist.
|
||||
# Effects:
|
||||
# 1. There is no guarantee to find immediate the user 'event_scheduler'
|
||||
# within information_schema.processlist.
|
||||
# 2. Some states of the user 'event_scheduler' found in PROCESSLIST:
|
||||
# USER HOST DB COMMAND TIME STATE INFO
|
||||
# event_scheduler localhost NULL Daemon 0 Waiting on empty queue NULL
|
||||
# event_scheduler localhost NULL Daemon 0 Initialized NULL
|
||||
# 2. SET GLOBAL event_scheduler = 'OFF';
|
||||
# Immediate observation of the processlist.
|
||||
# Effects:
|
||||
# 1. I never found the user 'event_scheduler' within the processlist.
|
||||
# 2. Events just during execution could be found within the processlist
|
||||
# = It does not look like "SET GLOBAL event_scheduler = 'OFF'" stops them.
|
||||
# 3. An event gets executed
|
||||
# USER evtest1 (Definer of event)
|
||||
# DB events_test (DB during time of event creation)
|
||||
# COMMAND Connect
|
||||
# STATE NULL
|
||||
# INFO SET @evname = 'ev_sched_1823' (Part of the event code)
|
||||
# ==> Everything mentioned in 1.2 above could be observed.
|
||||
#
|
||||
# Several subtests were weak because they showed random result set differences after issuing
|
||||
# "SET GLOBAL EVENT_SCHEDULER= off;".
|
||||
# 1. Reason one: There were already event executors
|
||||
# Fix: Wait till there is no event executor active ==> no session WHERE
|
||||
# - command IN ('Connect')
|
||||
# There must be no parallel session being just in "Connect" phase!
|
||||
# or
|
||||
# - user = <who created the maybe current running events>
|
||||
# There must be no parallel session of this person.
|
||||
# or user = 'event_scheduler' with command = 'Connect'
|
||||
# The session which will soon change its identity to event creator.
|
||||
#
|
||||
# 2. Reason two: If an event modifies a MyISAM table than a delayed visibilty of changes
|
||||
# might occur (concurrent_inserts=on or delayed inserts ...).
|
||||
#
|
||||
|
||||
# Can't test with embedded server that doesn't support grants
|
||||
@ -47,6 +140,10 @@ drop database if exists mysqltest_db2;
|
||||
--enable_warnings
|
||||
create database events_test;
|
||||
use events_test;
|
||||
# We use MyISAM tables and must avoid effects (visibility of changes might be
|
||||
# delayed) caused by concurrent_insert on (default).
|
||||
set @concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert = 0;
|
||||
|
||||
#
|
||||
# START: Bug #31332 --event-scheduler option misbehaving
|
||||
@ -56,8 +153,11 @@ use events_test;
|
||||
# option with no argument in events_bugs-master.opt turns the scheduler on.
|
||||
|
||||
select * from information_schema.global_variables where variable_name like 'event_scheduler';
|
||||
# Check that the event_scheduler is really running
|
||||
--source include/running_event_scheduler.inc
|
||||
|
||||
SET GLOBAL event_scheduler = 'OFF';
|
||||
--source include/check_events_off.inc
|
||||
|
||||
#
|
||||
# END: Bug #31332
|
||||
@ -132,8 +232,10 @@ create event e_55 on schedule every 10 hour starts 10000101000000 do drop table
|
||||
# Start - 16407: Events: Changes in sql_mode won't be taken into account
|
||||
#
|
||||
set global event_scheduler=off;
|
||||
--source include/check_events_off.inc
|
||||
delete from mysql.event;
|
||||
set global event_scheduler= on;
|
||||
--source include/running_event_scheduler.inc
|
||||
set @old_sql_mode:=@@sql_mode;
|
||||
set sql_mode=ansi;
|
||||
select get_lock('test_bug16407', 60);
|
||||
@ -148,13 +250,13 @@ delimiter ;|
|
||||
# We wait till one event runs and hangs when trying to get the user lock.
|
||||
let $wait_condition=
|
||||
select count(*) > 0 from information_schema.processlist
|
||||
where info = 'select get_lock(\'test_bug16407\', 60)';
|
||||
where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo "Now if everything is fine the event has compiled and is locked"
|
||||
# Expect to see one session in events_test waiting for the user lock.
|
||||
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)';
|
||||
select release_lock('test_bug16407');
|
||||
# Try to avoid
|
||||
# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes in I_S.PROCESSLIST)
|
||||
@ -162,23 +264,27 @@ select release_lock('test_bug16407');
|
||||
# Bug#32782 User lock hash fails to find lock
|
||||
# "various issues related to missing or incorrect return results
|
||||
# from release_lock()."
|
||||
# Therefore we check here if the event executing session disappeared or
|
||||
# Therefore we check here if the event executor is no more locked or
|
||||
# we waited >= 5 seconds for this to happen.
|
||||
let $wait_timeout= 5;
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where info = 'select get_lock(\'test_bug16407\', 60)';
|
||||
where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)';
|
||||
--source include/wait_condition.inc
|
||||
if (!`$wait_condition`)
|
||||
{
|
||||
--echo ERROR: There must be no session with info = 'select get_lock('test_bug16407', 60) within the processlist.
|
||||
--echo ERROR: There must be no session with
|
||||
--echo state = 'User lock' and info = 'select get_lock('test_bug16407', 60)
|
||||
--echo within the processlist.
|
||||
--echo We probably hit Bug#32782 User lock hash fails to find lock
|
||||
eval select * from information_schema.processlist;
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--echo Abort
|
||||
exit;
|
||||
}
|
||||
|
||||
set global event_scheduler= off;
|
||||
# Wait till the event scheduler and all event executors have finished their work.
|
||||
--source include/check_events_off.inc
|
||||
|
||||
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
|
||||
--echo "Let's check whether we change the sql_mode on ALTER EVENT"
|
||||
@ -191,9 +297,10 @@ set sql_mode="ansi";
|
||||
select get_lock('ee_16407_2', 60);
|
||||
|
||||
set global event_scheduler= 1;
|
||||
--source include/running_event_scheduler.inc
|
||||
--echo "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);
|
||||
--echo "This should never insert something"
|
||||
delimiter |;
|
||||
create event ee_16407_2 on schedule every 60 second do
|
||||
@ -203,7 +310,7 @@ begin
|
||||
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
|
||||
end|
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
insert into events_smode_test values ('test','1980-19-02')|
|
||||
insert into events_test.events_smode_test values ('test','1980-19-02')|
|
||||
--echo "This is ok"
|
||||
create event ee_16407_3 on schedule every 60 second do
|
||||
begin
|
||||
@ -223,13 +330,20 @@ end|
|
||||
delimiter ;|
|
||||
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
|
||||
|
||||
# We wait till we have three event executors waiting for the removal of the lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 3 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)';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
# There is an extreme low risk that an additional event execution is just coming
|
||||
# up because
|
||||
# - the events have to be started every 60 seconds.
|
||||
# - we are just after event creation + waiting for seeing 3 locked
|
||||
# We expect to see three event executors in state 'User lock'.
|
||||
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)';
|
||||
|
||||
select release_lock('ee_16407_2');
|
||||
|
||||
# Try to avoid
|
||||
@ -244,13 +358,37 @@ let $wait_timeout= 5;
|
||||
let $wait_condition=
|
||||
select count(*) = 0
|
||||
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)';
|
||||
--source include/wait_condition.inc
|
||||
if (!`$wait_condition`)
|
||||
{
|
||||
--echo ERROR: There must be no session with
|
||||
--echo state = 'User lock' and info = 'select get_lock('test_bug16407_2', 60)
|
||||
--echo within the processlist.
|
||||
--echo We probably hit Bug#32782 User lock hash fails to find lock
|
||||
SELECT * FROM information_schema.processlist;
|
||||
--echo Abort
|
||||
exit;
|
||||
}
|
||||
|
||||
# We expect to see no event executors in state 'User lock'.
|
||||
if(!$fixed_bug41925)
|
||||
{
|
||||
--disable_warnings
|
||||
}
|
||||
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)';
|
||||
if(!$fixed_bug41925)
|
||||
{
|
||||
--enable_warnings
|
||||
}
|
||||
|
||||
set global event_scheduler= off;
|
||||
select * from events_smode_test order by ev_name, a;
|
||||
# Wait till the event scheduler and all event executors have finished their work.
|
||||
# Without this the next queries will give unstable results.
|
||||
--source include/check_events_off.inc
|
||||
|
||||
select * from events_test.events_smode_test order by ev_name, a;
|
||||
--echo "OK, last check before we drop them"
|
||||
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
|
||||
drop event ee_16407_2;
|
||||
@ -259,11 +397,12 @@ drop event ee_16407_4;
|
||||
|
||||
|
||||
--echo "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);
|
||||
|
||||
set global event_scheduler= on;
|
||||
--source include/running_event_scheduler.inc
|
||||
|
||||
set sql_mode='traditional';
|
||||
delimiter |;
|
||||
@ -286,34 +425,46 @@ delimiter ;|
|
||||
|
||||
let $wait_condition=
|
||||
select count(*) = 2 from information_schema.processlist
|
||||
where info = 'select get_lock(\'ee_16407_5\', 60)';
|
||||
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo "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)';
|
||||
|
||||
select release_lock('ee_16407_5');
|
||||
|
||||
let $wait_condition=
|
||||
select count(*) = 1 and user = 'event_scheduler' and info is null
|
||||
from information_schema.processlist
|
||||
where (command!='Daemon' || user='event_scheduler')
|
||||
and (info is null or info not like '%processlist%');
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo "Should have 0 processes locked"
|
||||
if(!$fixed_bug41925)
|
||||
{
|
||||
--disable_warnings
|
||||
}
|
||||
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;
|
||||
select * from events_smode_test order by ev_name, a;
|
||||
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
|
||||
if(!$fixed_bug41925)
|
||||
{
|
||||
--enable_warnings
|
||||
}
|
||||
|
||||
# Wait till all event executors have finished their work, so that we can be sure
|
||||
# that their changes to events_smode_test are done.
|
||||
--source include/no_running_events.inc
|
||||
|
||||
select * from events_test.events_smode_test order by ev_name, a;
|
||||
--echo "And here we check one more time before we drop the events"
|
||||
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
|
||||
|
||||
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= off;
|
||||
--source include/check_events_off.inc
|
||||
drop table events_smode_test;
|
||||
set sql_mode=@old_sql_mode;
|
||||
#
|
||||
@ -324,6 +475,7 @@ set sql_mode=@old_sql_mode;
|
||||
# START - 18897: Events: unauthorized action possible with alter event rename
|
||||
#
|
||||
set global event_scheduler=off;
|
||||
--source include/check_events_off.inc
|
||||
--disable_warnings
|
||||
delete from mysql.user where User like 'mysqltest_%';
|
||||
delete from mysql.db where User like 'mysqltest_%';
|
||||
@ -409,6 +561,7 @@ create function f22830 () returns int return 5;
|
||||
|
||||
select get_lock('ee_22830', 60);
|
||||
set global event_scheduler=on;
|
||||
--source include/running_event_scheduler.inc
|
||||
|
||||
delimiter |;
|
||||
create procedure p22830_wait()
|
||||
@ -456,6 +609,7 @@ let $wait_condition=
|
||||
--source include/wait_condition.inc
|
||||
|
||||
set global event_scheduler=off;
|
||||
--source include/check_events_off.inc
|
||||
select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
|
||||
drop procedure p22830_wait;
|
||||
drop function f22830;
|
||||
@ -537,6 +691,7 @@ DROP USER mysqltest_u1@localhost;
|
||||
# For the actual tests of time zones please see events_time_zone.test
|
||||
#
|
||||
SET GLOBAL EVENT_SCHEDULER= OFF;
|
||||
--source include/check_events_off.inc
|
||||
SET @save_time_zone= @@TIME_ZONE;
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@ -749,6 +904,7 @@ let $engine=MyISAM;
|
||||
USE test;
|
||||
SHOW GRANTS FOR CURRENT_USER;
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
--source include/running_event_scheduler.inc
|
||||
eval
|
||||
CREATE TABLE events_test.event_log
|
||||
(id int KEY AUTO_INCREMENT, ev_nm char(40), ev_cnt int, ev_tm timestamp)
|
||||
@ -817,12 +973,14 @@ disconnect e1;
|
||||
DROP EVENT events_test.ev_sched_1823;
|
||||
DROP TABLE events_test.event_log;
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
--source include/check_events_off.inc
|
||||
|
||||
|
||||
#
|
||||
# Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
|
||||
#
|
||||
SET GLOBAL event_scheduler= ON;
|
||||
--source include/running_event_scheduler.inc
|
||||
DELIMITER |;
|
||||
CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
|
||||
DO BEGIN
|
||||
@ -831,6 +989,7 @@ END;|
|
||||
|
||||
DELIMITER ;|
|
||||
SET GLOBAL event_scheduler= OFF;
|
||||
--source include/check_events_off.inc
|
||||
DROP EVENT bug28641;
|
||||
|
||||
###########################################################################
|
||||
@ -955,6 +1114,7 @@ SET GLOBAL READ_ONLY = 1;
|
||||
--echo
|
||||
|
||||
SET GLOBAL EVENT_SCHEDULER = ON;
|
||||
--source include/running_event_scheduler.inc
|
||||
|
||||
--echo
|
||||
|
||||
@ -980,6 +1140,7 @@ let $wait_condition =
|
||||
--echo
|
||||
|
||||
SET GLOBAL EVENT_SCHEDULER = OFF;
|
||||
--source include/check_events_off.inc
|
||||
|
||||
--echo
|
||||
|
||||
@ -1056,14 +1217,15 @@ drop event e1;
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where db='events_test' and command = 'Connect' and user=current_user();
|
||||
--source include/wait_condition.inc
|
||||
# Ensure that all event executors have finished their work and cannot harm
|
||||
# the next test.
|
||||
--source include/no_running_events.inc
|
||||
|
||||
DROP DATABASE events_test;
|
||||
# Restore the original state (option with no argument in events_bugs-master.opt
|
||||
# turns the scheduler on).
|
||||
SET GLOBAL event_scheduler = 'ON';
|
||||
--source include/running_event_scheduler.inc
|
||||
SET @@global.concurrent_insert = @concurrent_insert;
|
||||
|
||||
# THIS MUST BE THE LAST LINE in this file.
|
||||
|
@ -1,6 +1,28 @@
|
||||
-- source include/not_embedded.inc
|
||||
### t/log_state.test ###
|
||||
#
|
||||
# This test suffers from server
|
||||
# Bug#38124 "general_log_file" variable silently unset when using expression
|
||||
# In short:
|
||||
# SET GLOBAL general_log_file = @<whatever>
|
||||
# SET GLOBAL slow_query_log = @<whatever>
|
||||
# cause that the value of these server system variables is set to default
|
||||
# instead of the assigned values. There comes no error message or warning.
|
||||
# If this bug is fixed please
|
||||
# 1. try this test with "let $fixed_bug38124 = 0;"
|
||||
# 2. remove all workarounds if 1. was successful.
|
||||
let $fixed_bug38124 = 0;
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_csv.inc
|
||||
|
||||
# Several subtests modify global variables. Save the initial values only here,
|
||||
# but reset to the initial values per subtest.
|
||||
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;
|
||||
|
||||
|
||||
--disable_ps_protocol
|
||||
set global general_log= OFF;
|
||||
truncate table mysql.general_log;
|
||||
@ -23,20 +45,32 @@ show global variables
|
||||
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
|
||||
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
|
||||
|
||||
--echo # Establish connection con1 (user=root)
|
||||
connect (con1,localhost,root,,);
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
set session long_query_time=1;
|
||||
select sleep(2);
|
||||
# Please increase @long_query_time if the corresponding selects show an
|
||||
# additional unexpected entry like
|
||||
# start_time ... sql_text
|
||||
# TIMESTAMP ... set session long_query_time=...
|
||||
# (Bug#40377 sporadic pushbuild failure in log_state: result mismatch)
|
||||
--replace_result 2 <long_query_time>
|
||||
set @long_query_time = 2;
|
||||
set session long_query_time = @long_query_time;
|
||||
select sleep(@long_query_time + 1);
|
||||
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
|
||||
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
|
||||
--echo # Switch to connection default
|
||||
connection default;
|
||||
|
||||
set global slow_query_log= ON;
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
set session long_query_time=1;
|
||||
select sleep(2);
|
||||
set session long_query_time = @long_query_time;
|
||||
select sleep(@long_query_time + 1);
|
||||
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
|
||||
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
|
||||
--echo # Switch to connection default
|
||||
connection default;
|
||||
show global variables
|
||||
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
|
||||
@ -71,16 +105,16 @@ show variables like 'slow_query_log_file';
|
||||
show variables like 'log_output';
|
||||
|
||||
# Can't set general_log_file to a non existing file
|
||||
--error 1231
|
||||
set global general_log_file='/not exiting path/log.master';
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global general_log_file='/not existing path/log.master';
|
||||
|
||||
# Can't set general_log_file to a directory
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--error 1231
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
eval set global general_log_file='$MYSQLTEST_VARDIR';
|
||||
|
||||
# Can't set general_log_file to empty string
|
||||
--error 1231
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global general_log_file='';
|
||||
|
||||
--replace_column 2 #
|
||||
@ -126,17 +160,30 @@ drop table t1;
|
||||
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
|
||||
select * from mysql.general_log;
|
||||
|
||||
# Reset to initial values
|
||||
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;
|
||||
if(!$fixed_bug38124)
|
||||
{
|
||||
--disable_query_log
|
||||
let $my_var = `SELECT @old_general_log_file`;
|
||||
eval SET @@global.general_log_file = '$my_var';
|
||||
let $my_var = `SELECT @old_slow_query_log_file`;
|
||||
eval SET @@global.slow_query_log_file = '$my_var';
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
|
||||
# a deadlock)
|
||||
|
||||
# save state
|
||||
|
||||
SET @old_general_log_state = @@global.general_log;
|
||||
SET @old_slow_log_state = @@global.slow_query_log;
|
||||
# a deadlock)
|
||||
#
|
||||
|
||||
# Test ON->OFF transition under a GLOBAL READ LOCK
|
||||
|
||||
SET GLOBAL general_log = ON;
|
||||
SET GLOBAL slow_query_log = ON;
|
||||
|
||||
@ -148,7 +195,6 @@ SET GLOBAL slow_query_log = OFF;
|
||||
UNLOCK TABLES;
|
||||
|
||||
# Test OFF->ON transition under a GLOBAL READ LOCK
|
||||
|
||||
FLUSH TABLES WITH READ LOCK;
|
||||
|
||||
SET GLOBAL general_log = ON;
|
||||
@ -157,7 +203,6 @@ SET GLOBAL slow_query_log = ON;
|
||||
UNLOCK TABLES;
|
||||
|
||||
# Test ON->OFF transition under a GLOBAL READ_ONLY
|
||||
|
||||
SET GLOBAL READ_ONLY = ON;
|
||||
|
||||
SET GLOBAL general_log = OFF;
|
||||
@ -166,7 +211,6 @@ SET GLOBAL slow_query_log = OFF;
|
||||
SET GLOBAL READ_ONLY = OFF;
|
||||
|
||||
# Test OFF->ON transition under a GLOBAL READ_ONLY
|
||||
|
||||
SET GLOBAL READ_ONLY = ON;
|
||||
|
||||
SET GLOBAL general_log = ON;
|
||||
@ -174,17 +218,18 @@ SET GLOBAL slow_query_log = ON;
|
||||
|
||||
SET GLOBAL READ_ONLY = OFF;
|
||||
|
||||
# Restore state
|
||||
# Reset to initial values
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
|
||||
SET GLOBAL general_log = @old_general_log_state;
|
||||
SET GLOBAL slow_query_log = @old_slow_log_state;
|
||||
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# Bug #29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it
|
||||
# Bug#29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it
|
||||
#
|
||||
|
||||
SET @old_general_log_state = @@global.general_log;
|
||||
SET @old_slow_log_state = @@global.slow_query_log;
|
||||
SET GLOBAL general_log = ON;
|
||||
|
||||
SHOW VARIABLES LIKE 'general_log';
|
||||
SHOW VARIABLES LIKE 'log';
|
||||
@ -210,39 +255,47 @@ SHOW VARIABLES LIKE 'slow_query_log';
|
||||
SHOW VARIABLES LIKE 'log_slow_queries';
|
||||
SELECT @@slow_query_log, @@log_slow_queries;
|
||||
|
||||
SET GLOBAL general_log = @old_general_log_state;
|
||||
SET GLOBAL slow_query_log = @old_slow_log_state;
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
|
||||
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# Bug #31604: server crash when setting slow_query_log_file/general_log_file
|
||||
# Bug#31604: server crash when setting slow_query_log_file/general_log_file
|
||||
#
|
||||
set @old_general_log_file= @@global.general_log_file;
|
||||
set @old_slow_query_log_file= @@global.slow_query_log_file;
|
||||
|
||||
--error 1231
|
||||
set global general_log_file= concat('/not exiting path/log.maste', 'r');
|
||||
--error 1231
|
||||
set global general_log_file= NULL;
|
||||
--error 1231
|
||||
set global slow_query_log_file= concat('/not exiting path/log.maste', 'r');
|
||||
--error 1231
|
||||
set global slow_query_log_file= NULL;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r');
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET GLOBAL general_log_file= NULL;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET GLOBAL slow_query_log_file= CONCAT('/not existing path/log.maste', 'r');
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET GLOBAL slow_query_log_file= NULL;
|
||||
|
||||
# Reset to initial values in case a setting above was successful.
|
||||
SET GLOBAL general_log_file= @old_general_log_file;
|
||||
SET GLOBAL slow_query_log_file= @old_slow_query_log_file;
|
||||
if(!$fixed_bug38124)
|
||||
{
|
||||
--disable_query_log
|
||||
let $my_var = `SELECT @old_general_log_file`;
|
||||
eval SET @@global.general_log_file = '$my_var';
|
||||
let $my_var = `SELECT @old_slow_query_log_file`;
|
||||
eval SET @@global.slow_query_log_file = '$my_var';
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
set global general_log_file= @old_general_log_file;
|
||||
set global slow_query_log_file= @old_slow_query_log_file;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo # --
|
||||
--echo # -- Bug#32748: Inconsistent handling of assignments to
|
||||
--echo # -- general_log_file/slow_query_log_file.
|
||||
--echo # -- general_log_file/slow_query_log_file.
|
||||
--echo # --
|
||||
|
||||
--echo
|
||||
SET @general_log_file_saved = @@global.general_log_file;
|
||||
SET @slow_query_log_file_saved = @@global.slow_query_log_file;
|
||||
|
||||
--echo
|
||||
SET GLOBAL general_log_file = 'bug32748.query.log';
|
||||
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
|
||||
@ -250,27 +303,37 @@ SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
|
||||
--echo
|
||||
SHOW VARIABLES LIKE '%log_file';
|
||||
|
||||
# Reset to initial values
|
||||
--echo
|
||||
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;
|
||||
if(!$fixed_bug38124)
|
||||
{
|
||||
--disable_query_log
|
||||
let $my_var = `SELECT @old_general_log_file`;
|
||||
eval SET @@global.general_log_file = '$my_var';
|
||||
let $my_var = `SELECT @old_slow_query_log_file`;
|
||||
eval SET @@global.slow_query_log_file = '$my_var';
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo # -- End of Bug#32748.
|
||||
|
||||
|
||||
###########################################################################
|
||||
|
||||
# WL#4403 - deprecate @log and @slow_log_queries variables
|
||||
|
||||
|
||||
## WL#4403 - deprecate @log and @slow_log_queries variables
|
||||
|
||||
## these are all deprecated -- show for command-line as well!
|
||||
# These server system variables are all deprecated
|
||||
# -- show for command-line as well!
|
||||
--echo deprecated:
|
||||
SET GLOBAL log = 0;
|
||||
SET GLOBAL log_slow_queries = 0;
|
||||
SET GLOBAL log = DEFAULT;
|
||||
SET GLOBAL log_slow_queries = DEFAULT;
|
||||
|
||||
## these are NOT deprecated
|
||||
# These server system variables are NOT deprecated.
|
||||
--echo not deprecated:
|
||||
SELECT @@global.general_log_file INTO @my_glf;
|
||||
SELECT @@global.slow_query_log_file INTO @my_sqlf;
|
||||
@ -283,6 +346,20 @@ SET GLOBAL slow_query_log_file = @my_sqlf;
|
||||
SET GLOBAL general_log = DEFAULT;
|
||||
SET GLOBAL slow_query_log = DEFAULT;
|
||||
|
||||
## Reset to initial values
|
||||
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;
|
||||
if(!$fixed_bug38124)
|
||||
{
|
||||
--disable_query_log
|
||||
let $my_var = `SELECT @old_general_log_file`;
|
||||
eval SET @@global.general_log_file = '$my_var';
|
||||
let $my_var = `SELECT @old_slow_query_log_file`;
|
||||
eval SET @@global.slow_query_log_file = '$my_var';
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
|
||||
--echo End of 5.1 tests
|
||||
@ -290,10 +367,27 @@ SET GLOBAL slow_query_log = DEFAULT;
|
||||
--enable_ps_protocol
|
||||
|
||||
#
|
||||
# Cleanup (must be done last to avoid delayed 'Quit' message in general log)
|
||||
# Cleanup
|
||||
#
|
||||
# Disconnect must be done last to avoid delayed 'Quit' message in general log
|
||||
--echo # Close connection con1
|
||||
disconnect con1;
|
||||
# Reset global system variables to initial values if forgotten somewhere above.
|
||||
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;
|
||||
if(!$fixed_bug38124)
|
||||
{
|
||||
--disable_query_log
|
||||
let $my_var = `SELECT @old_general_log_file`;
|
||||
eval SET @@global.general_log_file = '$my_var';
|
||||
let $my_var = `SELECT @old_slow_query_log_file`;
|
||||
eval SET @@global.slow_query_log_file = '$my_var';
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# Remove the log files that was created in the "default location"
|
||||
# i.e var/run
|
||||
--remove_file $MYSQLTEST_VARDIR/run/master.log
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/log.master
|
||||
|
@ -62,7 +62,7 @@ drop table t1;
|
||||
# Test of date and not null
|
||||
#
|
||||
|
||||
create table t1 (date date);
|
||||
create table t1 (date date);
|
||||
insert into t1 values ("2000-08-10"),("2000-08-11");
|
||||
select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1;
|
||||
drop table t1;
|
||||
@ -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);
|
||||
|
Reference in New Issue
Block a user