log_state.test 4.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
-- source include/not_embedded.inc
--source include/have_csv.inc

--disable_ps_protocol
set global general_log= OFF;
truncate table mysql.general_log;
truncate table mysql.slow_log;
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
flush logs;
set global general_log= ON;
create table t1(f1 int);
14
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
15 16 17
select * from mysql.general_log;
set global general_log= OFF;
drop table t1;
18
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
19 20 21 22 23 24 25 26 27 28 29
select * from mysql.general_log;
set global general_log= ON;
flush logs;
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';

connect (con1,localhost,root,,);
connection con1;
set session long_query_time=1;
select sleep(2);
30
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
31 32 33 34 35 36 37
select * from mysql.slow_log;
connection default;

set global slow_query_log= ON;
connection con1;
set session long_query_time=1;
select sleep(2);
38
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
select * from mysql.slow_log;
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';

set global general_log= ON;
set global general_log= OFF;
set global general_log= OFF;
set global slow_query_log= ON;
set global slow_query_log= OFF;
set global slow_query_log= OFF;

set global general_log= ON;
truncate table mysql.general_log;
create table t1(f1 int);
drop table t1;
56
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
57 58 59
select * from mysql.general_log;
set global general_log= OFF;
truncate table mysql.general_log;
60
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
61 62 63 64 65 66 67 68 69 70 71 72
select * from mysql.general_log;
set global general_log= ON;
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';

--replace_column 2 #
show variables like 'general_log_file';
--replace_column 2 #
show variables like 'slow_query_log_file';
show variables like 'log_output';

73
# Can't set general_log_file to a non existing file
74 75
--error 1231
set global general_log_file='/not exiting path/log.master';
76 77 78

# Can't set general_log_file to a directory
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
79
--error 1231
80 81 82
eval set global general_log_file='$MYSQLTEST_VARDIR';

# Can't set general_log_file to empty string
83 84
--error 1231
set global general_log_file='';
85

86 87 88
--replace_column 2 #
show variables like 'general_log_file';
set global general_log= OFF;
89 90
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval set global general_log_file='$MYSQLTEST_VARDIR/tmp/log.master';
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
set global general_log= ON;
create table t1(f1 int);
drop table t1;
set global general_log= OFF;
set global general_log_file=default;
set global general_log= ON;
create table t1(f1 int);
drop table t1;
--replace_column 2 #
show variables like 'general_log_file';
--replace_column 2 #
show variables like 'slow_query_log_file';

set global general_log= default;
set global slow_query_log= default;
set global general_log_file= default;
set global slow_query_log_file= default;
show variables like 'general_log';
show variables like 'slow_query_log';
set global general_log=ON;
set global log_output=default;
show variables like 'log_output';
set global general_log=OFF;
set global log_output=FILE;
truncate table mysql.general_log;
show variables like 'log_output';
set global general_log=ON;
create table t1(f1 int);
119
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
120 121 122 123 124 125
select * from mysql.general_log;
set global general_log=OFF;
set global log_output="FILE,TABLE";
show variables like 'log_output';
set global general_log=ON;
drop table t1;
126
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
127 128 129
select * from mysql.general_log;

--enable_ps_protocol
130 131 132 133 134

#
# Cleanup (must be done last to avoid delayed 'Quit' message in general log)
#
disconnect con1;
135 136 137 138

# Remove the log files that was created in the "default location"
# i.e var/run
--remove_file $MYSQLTEST_VARDIR/run/master.log