1
-- source include/not_embedded.inc
2
--source include/have_csv.inc
5
set global general_log= OFF;
6
truncate table mysql.general_log;
7
truncate table mysql.slow_log;
9
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
10
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
12
set global general_log= ON;
13
create table t1(f1 int);
14
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
15
select * from mysql.general_log;
16
set global general_log= OFF;
18
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
19
select * from mysql.general_log;
20
set global general_log= ON;
23
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
24
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
26
connect (con1,localhost,root,,);
28
set session long_query_time=1;
30
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
31
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
34
set global slow_query_log= ON;
36
set session long_query_time=1;
38
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
39
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
42
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
43
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
45
set global general_log= ON;
46
set global general_log= OFF;
47
set global general_log= OFF;
48
set global slow_query_log= ON;
49
set global slow_query_log= OFF;
50
set global slow_query_log= OFF;
52
set global general_log= ON;
53
truncate table mysql.general_log;
54
create table t1(f1 int);
56
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
57
select * from mysql.general_log;
58
set global general_log= OFF;
59
truncate table mysql.general_log;
60
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
61
select * from mysql.general_log;
62
set global general_log= ON;
64
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
65
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
68
show variables like 'general_log_file';
70
show variables like 'slow_query_log_file';
71
show variables like 'log_output';
73
# Can't set general_log_file to a non existing file
75
set global general_log_file='/not exiting path/log.master';
77
# Can't set general_log_file to a directory
78
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
80
eval set global general_log_file='$MYSQLTEST_VARDIR';
82
# Can't set general_log_file to empty string
84
set global general_log_file='';
87
show variables like 'general_log_file';
88
set global general_log= OFF;
89
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
90
eval set global general_log_file='$MYSQLTEST_VARDIR/tmp/log.master';
91
set global general_log= ON;
92
create table t1(f1 int);
94
set global general_log= OFF;
95
set global general_log_file=default;
96
set global general_log= ON;
97
create table t1(f1 int);
100
show variables like 'general_log_file';
102
show variables like 'slow_query_log_file';
104
set global general_log= default;
105
set global slow_query_log= default;
106
set global general_log_file= default;
107
set global slow_query_log_file= default;
108
show variables like 'general_log';
109
show variables like 'slow_query_log';
110
set global general_log=ON;
111
set global log_output=default;
112
show variables like 'log_output';
113
set global general_log=OFF;
114
set global log_output=FILE;
115
truncate table mysql.general_log;
116
show variables like 'log_output';
117
set global general_log=ON;
118
create table t1(f1 int);
119
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
120
select * from mysql.general_log;
121
set global general_log=OFF;
122
set global log_output="FILE,TABLE";
123
show variables like 'log_output';
124
set global general_log=ON;
126
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
127
select * from mysql.general_log;
130
# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
135
SET @old_general_log_state = @@global.general_log;
136
SET @old_slow_log_state = @@global.slow_query_log;
138
# Test ON->OFF transition under a GLOBAL READ LOCK
140
SET GLOBAL general_log = ON;
141
SET GLOBAL slow_query_log = ON;
143
FLUSH TABLES WITH READ LOCK;
145
SET GLOBAL general_log = OFF;
146
SET GLOBAL slow_query_log = OFF;
150
# Test OFF->ON transition under a GLOBAL READ LOCK
152
FLUSH TABLES WITH READ LOCK;
154
SET GLOBAL general_log = ON;
155
SET GLOBAL slow_query_log = ON;
159
# Test ON->OFF transition under a GLOBAL READ_ONLY
161
SET GLOBAL READ_ONLY = ON;
163
SET GLOBAL general_log = OFF;
164
SET GLOBAL slow_query_log = OFF;
166
SET GLOBAL READ_ONLY = OFF;
168
# Test OFF->ON transition under a GLOBAL READ_ONLY
170
SET GLOBAL READ_ONLY = ON;
172
SET GLOBAL general_log = ON;
173
SET GLOBAL slow_query_log = ON;
175
SET GLOBAL READ_ONLY = OFF;
179
SET GLOBAL general_log = @old_general_log_state;
180
SET GLOBAL slow_query_log = @old_slow_log_state;
183
# Bug #29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it
186
SET @old_general_log_state = @@global.general_log;
187
SET @old_slow_log_state = @@global.slow_query_log;
189
SHOW VARIABLES LIKE 'general_log';
190
SHOW VARIABLES LIKE 'log';
191
SELECT @@general_log, @@log;
193
SHOW VARIABLES LIKE 'general_log';
194
SHOW VARIABLES LIKE 'log';
195
SELECT @@general_log, @@log;
196
SET GLOBAL general_log = 1;
197
SHOW VARIABLES LIKE 'general_log';
198
SHOW VARIABLES LIKE 'log';
199
SELECT @@general_log, @@log;
201
SHOW VARIABLES LIKE 'slow_query_log';
202
SHOW VARIABLES LIKE 'log_slow_queries';
203
SELECT @@slow_query_log, @@log_slow_queries;
204
SET GLOBAL log_slow_queries = 0;
205
SHOW VARIABLES LIKE 'slow_query_log';
206
SHOW VARIABLES LIKE 'log_slow_queries';
207
SELECT @@slow_query_log, @@log_slow_queries;
208
SET GLOBAL slow_query_log = 1;
209
SHOW VARIABLES LIKE 'slow_query_log';
210
SHOW VARIABLES LIKE 'log_slow_queries';
211
SELECT @@slow_query_log, @@log_slow_queries;
213
SET GLOBAL general_log = @old_general_log_state;
214
SET GLOBAL slow_query_log = @old_slow_log_state;
217
# Bug #31604: server crash when setting slow_query_log_file/general_log_file
219
set @old_general_log_file= @@global.general_log_file;
220
set @old_slow_query_log_file= @@global.slow_query_log_file;
223
set global general_log_file= concat('/not exiting path/log.maste', 'r');
225
set global general_log_file= NULL;
227
set global slow_query_log_file= concat('/not exiting path/log.maste', 'r');
229
set global slow_query_log_file= NULL;
231
set global general_log_file= @old_general_log_file;
232
set global slow_query_log_file= @old_slow_query_log_file;
234
###########################################################################
238
--echo # -- Bug#32748: Inconsistent handling of assignments to
239
--echo # -- general_log_file/slow_query_log_file.
243
SET @general_log_file_saved = @@global.general_log_file;
244
SET @slow_query_log_file_saved = @@global.slow_query_log_file;
247
SET GLOBAL general_log_file = 'bug32748.query.log';
248
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
251
SHOW VARIABLES LIKE '%log_file';
254
SET GLOBAL general_log_file = @general_log_file_saved;
255
SET GLOBAL slow_query_log_file = @slow_query_log_file_saved;
258
--echo # -- End of Bug#32748.
260
###########################################################################
262
--echo End of 5.1 tests
267
# Cleanup (must be done last to avoid delayed 'Quit' message in general log)
271
# Remove the log files that was created in the "default location"
273
--remove_file $MYSQLTEST_VARDIR/run/master.log