~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
--source include/have_csv.inc
2
3
--disable_ps_protocol
4
set global general_log= OFF;
5
truncate table mysql.general_log;
6
truncate table mysql.slow_log;
7
show global variables
8
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
9
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
10
flush logs;
11
set global general_log= ON;
12
create table t1(f1 int);
13
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
14
select * from mysql.general_log;
15
set global general_log= OFF;
16
drop table t1;
17
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
18
select * from mysql.general_log;
19
set global general_log= ON;
20
flush logs;
21
show global variables
22
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
23
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
24
25
connect (con1,localhost,root,,);
26
connection con1;
27
set session long_query_time=1;
28
select sleep(2);
29
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
30
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
31
connection default;
32
33
set global slow_query_log= ON;
34
connection con1;
35
set session long_query_time=1;
36
select sleep(2);
37
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME
38
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
39
connection default;
40
show global variables
41
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
42
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
43
44
set global general_log= ON;
45
set global general_log= OFF;
46
set global general_log= OFF;
47
set global slow_query_log= ON;
48
set global slow_query_log= OFF;
49
set global slow_query_log= OFF;
50
51
set global general_log= ON;
52
truncate table mysql.general_log;
53
create table t1(f1 int);
54
drop table t1;
55
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
56
select * from mysql.general_log;
57
set global general_log= OFF;
58
truncate table mysql.general_log;
59
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
60
select * from mysql.general_log;
61
set global general_log= ON;
62
show global variables
63
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
64
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
65
66
--replace_column 2 #
67
show variables like 'general_log_file';
68
--replace_column 2 #
69
show variables like 'slow_query_log_file';
70
show variables like 'log_output';
71
72
# Can't set general_log_file to a non existing file
73
--error 1231
74
set global general_log_file='/not exiting path/log.master';
75
76
# Can't set general_log_file to a directory
77
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
78
--error 1231
79
eval set global general_log_file='$MYSQLTEST_VARDIR';
80
81
# Can't set general_log_file to empty string
82
--error 1231
83
set global general_log_file='';
84
85
--replace_column 2 #
86
show variables like 'general_log_file';
87
set global general_log= OFF;
88
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
89
eval set global general_log_file='$MYSQLTEST_VARDIR/tmp/log.master';
90
set global general_log= ON;
91
create table t1(f1 int);
92
drop table t1;
93
set global general_log= OFF;
94
set global general_log_file=default;
95
set global general_log= ON;
96
create table t1(f1 int);
97
drop table t1;
98
--replace_column 2 #
99
show variables like 'general_log_file';
100
--replace_column 2 #
101
show variables like 'slow_query_log_file';
102
103
set global general_log= default;
104
set global slow_query_log= default;
105
set global general_log_file= default;
106
set global slow_query_log_file= default;
107
show variables like 'general_log';
108
show variables like 'slow_query_log';
109
set global general_log=ON;
110
set global log_output=default;
111
show variables like 'log_output';
112
set global general_log=OFF;
113
set global log_output=FILE;
114
truncate table mysql.general_log;
115
show variables like 'log_output';
116
set global general_log=ON;
117
create table t1(f1 int);
118
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
119
select * from mysql.general_log;
120
set global general_log=OFF;
121
set global log_output="FILE,TABLE";
122
show variables like 'log_output';
123
set global general_log=ON;
124
drop table t1;
125
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
126
select * from mysql.general_log;
127
128
#
129
# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
130
# a deadlock)
131
132
# save state
133
134
SET @old_general_log_state = @@global.general_log;
135
SET @old_slow_log_state = @@global.slow_query_log;
136
137
# Test ON->OFF transition under a GLOBAL READ LOCK
138
139
SET GLOBAL general_log = ON;
140
SET GLOBAL slow_query_log = ON;
141
142
FLUSH TABLES WITH READ LOCK;
143
144
SET GLOBAL general_log = OFF;
145
SET GLOBAL slow_query_log = OFF;
146
147
UNLOCK TABLES;
148
149
# Test OFF->ON transition under a GLOBAL READ LOCK
150
151
FLUSH TABLES WITH READ LOCK;
152
153
SET GLOBAL general_log = ON;
154
SET GLOBAL slow_query_log = ON;
155
156
UNLOCK TABLES;
157
158
# Test ON->OFF transition under a GLOBAL READ_ONLY
159
160
SET GLOBAL READ_ONLY = ON;
161
162
SET GLOBAL general_log = OFF;
163
SET GLOBAL slow_query_log = OFF;
164
165
SET GLOBAL READ_ONLY = OFF;
166
167
# Test OFF->ON transition under a GLOBAL READ_ONLY
168
169
SET GLOBAL READ_ONLY = ON;
170
171
SET GLOBAL general_log = ON;
172
SET GLOBAL slow_query_log = ON;
173
174
SET GLOBAL READ_ONLY = OFF;
175
176
# Restore state
177
178
SET GLOBAL general_log = @old_general_log_state;
179
SET GLOBAL slow_query_log = @old_slow_log_state;
180
181
#
182
# Bug #29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it
183
#
184
185
SET @old_general_log_state = @@global.general_log;
186
SET @old_slow_log_state = @@global.slow_query_log;
187
188
SHOW VARIABLES LIKE 'general_log';
189
SHOW VARIABLES LIKE 'log';
190
SELECT @@general_log, @@log;
191
SET GLOBAL log = 0;
192
SHOW VARIABLES LIKE 'general_log';
193
SHOW VARIABLES LIKE 'log';
194
SELECT @@general_log, @@log;
195
SET GLOBAL general_log = 1;
196
SHOW VARIABLES LIKE 'general_log';
197
SHOW VARIABLES LIKE 'log';
198
SELECT @@general_log, @@log;
199
200
SHOW VARIABLES LIKE 'slow_query_log';
201
SHOW VARIABLES LIKE 'log_slow_queries';
202
SELECT @@slow_query_log, @@log_slow_queries;
203
SET GLOBAL log_slow_queries = 0;
204
SHOW VARIABLES LIKE 'slow_query_log';
205
SHOW VARIABLES LIKE 'log_slow_queries';
206
SELECT @@slow_query_log, @@log_slow_queries;
207
SET GLOBAL slow_query_log = 1;
208
SHOW VARIABLES LIKE 'slow_query_log';
209
SHOW VARIABLES LIKE 'log_slow_queries';
210
SELECT @@slow_query_log, @@log_slow_queries;
211
212
SET GLOBAL general_log = @old_general_log_state;
213
SET GLOBAL slow_query_log = @old_slow_log_state;
214
215
#
216
# Bug #31604: server crash when setting slow_query_log_file/general_log_file
217
#
218
set @old_general_log_file= @@global.general_log_file;
219
set @old_slow_query_log_file= @@global.slow_query_log_file;
220
221
--error 1231
222
set global general_log_file= concat('/not exiting path/log.maste', 'r');
223
--error 1231
224
set global general_log_file= NULL;
225
--error 1231
226
set global slow_query_log_file= concat('/not exiting path/log.maste', 'r');
227
--error 1231
228
set global slow_query_log_file= NULL;
229
230
set global general_log_file= @old_general_log_file;
231
set global slow_query_log_file= @old_slow_query_log_file;
232
233
###########################################################################
234
235
--echo
236
--echo # --
237
--echo # -- Bug#32748: Inconsistent handling of assignments to
238
--echo # -- general_log_file/slow_query_log_file.
239
--echo # --
240
241
--echo
242
SET @general_log_file_saved = @@global.general_log_file;
243
SET @slow_query_log_file_saved = @@global.slow_query_log_file;
244
245
--echo
246
SET GLOBAL general_log_file = 'bug32748.query.log';
247
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
248
249
--echo
250
SHOW VARIABLES LIKE '%log_file';
251
252
--echo
253
SET GLOBAL general_log_file = @general_log_file_saved;
254
SET GLOBAL slow_query_log_file = @slow_query_log_file_saved;
255
256
--echo
257
--echo # -- End of Bug#32748.
258
259
###########################################################################
260
261
--echo End of 5.1 tests
262
263
--enable_ps_protocol
264
265
#
266
# Cleanup (must be done last to avoid delayed 'Quit' message in general log)
267
#
268
disconnect con1;
269
270
# Remove the log files that was created in the "default location"
271
# i.e var/run
272
--remove_file $MYSQLTEST_VARDIR/run/master.log