1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-24 19:42:23 +03:00
Files
mariadb/mysql-test/t/events_logs_tests.test
Monty 9cba6c5aa3 Updated mtr files to support different compiled in options
This allows one to run the test suite even if any of the following
options are changed:
- character-set-server
- collation-server
- join-cache-level
- log-basename
- max-allowed-packet
- optimizer-switch
- query-cache-size and query-cache-type
- skip-name-resolve
- table-definition-cache
- table-open-cache
- Some innodb options
etc

Changes:
- Don't print out the value of system variables as one can't depend on
  them to being constants.
- Don't set global variables to 'default' as the default may not
  be the same as the test was started with if there was an additional
  option file. Instead save original value and reset it at end of test.
- Test that depends on the latin1 character set should include
  default_charset.inc or set the character set to latin1
- Test that depends on the original optimizer switch, should include
  default_optimizer_switch.inc
- Test that depends on the value of a specific system variable should
  set it in the test (like optimizer_use_condition_selectivity)
- Split subselect3.test into subselect3.test and subselect3.inc to
  make it easier to set and reset system variables.
- Added .opt files for test that required specfic options that could
  be changed by external configuration files.
- Fixed result files in rockdsb & tokudb that had not been updated for
  a while.
2019-09-01 19:17:35 +03:00

92 lines
3.2 KiB
Plaintext

# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
set @save_long_query_time=@@long_query_time;
--disable_warnings
drop database if exists events_test;
--enable_warnings
create database if not exists events_test;
use events_test;
--echo
--echo We use procedure here because its statements won't be
--echo logged into the general log. If we had used normal select
--echo that are logged in different ways depending on whether the
--echo test suite is run in normal mode or with --ps-protocol
--echo
delimiter |;
create procedure select_general_log()
begin
select user_host, argument from mysql.general_log
where argument like '%events_logs_test%';
end|
delimiter ;|
--echo
--echo Check that general query log works, but sub-statements
--echo of the stored procedure do not leave traces in it.
--echo
truncate mysql.general_log;
# Logging format in ps protocol is slightly different
--disable_ps_protocol
select 'events_logs_tests' as outside_event;
--enable_ps_protocol
--replace_column 1 USER_HOST
call select_general_log();
--echo
--echo Check that unlike sub-statements of stored procedures,
--echo sub-statements of events are present in the general log.
--echo
set global event_scheduler=on;
truncate mysql.general_log;
create event ev_log_general on schedule at now() on completion not preserve do select 'events_logs_test' as inside_event;
--let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
--source include/wait_condition.inc
--replace_column 1 USER_HOST
call select_general_log();
--echo
--echo Check slow query log
--echo
--echo Ensure that slow logging is on
show variables like 'slow_query_log';
--echo
--echo Demonstrate that session value has no effect
--echo
set @@session.long_query_time=1;
set @@global.long_query_time=300;
truncate mysql.slow_log;
create event ev_log_general on schedule at now() on completion not preserve
do select 'events_logs_test' as inside_event, sleep(1.5);
--let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
--source include/wait_condition.inc
--echo
--echo Nothing should be logged
--echo
--replace_column 1 USER_HOST
select user_host, db, sql_text from mysql.slow_log
where sql_text like 'select \'events_logs_test\'%';
set @@global.long_query_time=1;
truncate mysql.slow_log;
create event ev_log_general on schedule at now() on completion not preserve
do select 'events_logs_test' as inside_event, sleep(1.5);
--let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
--source include/wait_condition.inc
--echo
--echo Event sub-statement should be logged.
--echo
--replace_column 1 USER_HOST
select user_host, db, sql_text from mysql.slow_log
where sql_text like 'select \'events_logs_test\'%';
drop database events_test;
set global event_scheduler=off;
set @@global.long_query_time=@save_long_query_time;
set @@session.long_query_time=@save_long_query_time;
#
# Safety
#
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