~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/mysqlbinlog.test

  • Committer: Brian Aker
  • Date: 2008-07-20 07:10:24 UTC
  • Revision ID: brian@tangent.org-20080720071024-o1wv37gyy8ln5xgk
More my_bool cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# We are using .opt file since we need small binlog size
2
 
# TODO: Need to look at making a row based version once the new row based client is completed. [jbm]
3
 
 
4
 
 
5
 
# we need this for getting fixed timestamps inside of this test
6
 
set timestamp=1000000000;
7
 
 
8
 
--disable_warnings
9
 
drop table if exists t1,t2,t3,t4,t5,t03,t04;
10
 
--enable_warnings
11
 
 
12
 
create table t1 (word varchar(20));
13
 
create table t2 (id int auto_increment not null primary key);
14
 
 
15
 
# simple test for simple statement and various events
16
 
insert into t1 values ("abirvalg");
17
 
insert into t2 values ();
18
 
# Should be uncommented in 4.1
19
 
# set @a:=1
20
 
# insert into t2 values (@a);
21
 
 
22
 
# test for load data and load data distributed among the several 
23
 
# files (we need to fill up first binlog)
24
 
load data infile '../std_data_ln/words.dat' into table t1;
25
 
load data infile '../std_data_ln/words.dat' into table t1;
26
 
load data infile '../std_data_ln/words.dat' into table t1;
27
 
load data infile '../std_data_ln/words.dat' into table t1;
28
 
load data infile '../std_data_ln/words.dat' into table t1;
29
 
# simple query to show more in second binlog
30
 
insert into t1 values ("Alas");
31
 
flush logs;
32
 
 
33
 
# delimiters are for easier debugging in future
34
 
--disable_query_log
35
 
select "--- Local --" as "";
36
 
--enable_query_log
37
 
 
38
 
#
39
 
# We should use --short-form everywhere because in other case output will
40
 
# be time dependend. Better than nothing.
41
 
#
42
 
 
43
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
44
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
45
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000001
46
 
 
47
 
# this should not fail but shouldn't produce any working statements
48
 
--disable_query_log
49
 
select "--- Broken LOAD DATA --" as "";
50
 
--enable_query_log
51
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
52
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
53
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000002 2> /dev/null
54
 
 
55
 
# this should show almost nothing
56
 
--disable_query_log
57
 
select "--- --database --" as "";
58
 
--enable_query_log
59
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
60
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
61
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLTEST_VARDIR/log/master-bin.000001 2> /dev/null
62
 
 
63
 
# this test for position option
64
 
--disable_query_log
65
 
select "--- --position --" as "";
66
 
--enable_query_log
67
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
68
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
69
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=240 $MYSQLTEST_VARDIR/log/master-bin.000002
70
 
 
71
 
# These are tests for remote binlog.
72
 
# They should return the same as previous test.
73
 
 
74
 
--disable_query_log
75
 
select "--- Remote --" as "";
76
 
--enable_query_log
77
 
 
78
 
# This is broken now
79
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
80
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
81
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
82
 
 
83
 
# This is broken too
84
 
--disable_query_log
85
 
select "--- Broken LOAD DATA --" as "";
86
 
--enable_query_log
87
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
88
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
89
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 2> /dev/null
90
 
 
91
 
# And this too ! (altough it is documented)
92
 
--disable_query_log
93
 
select "--- --database --" as "";
94
 
--enable_query_log
95
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
96
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
97
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001 2> /dev/null
98
 
 
99
 
# Strangely but this works
100
 
--disable_query_log
101
 
select "--- --position --" as "";
102
 
--enable_query_log
103
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
104
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
105
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=240 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
106
 
 
107
 
# Bug#7853 (mysqlbinlog does not accept input from stdin)
108
 
--disable_query_log
109
 
select "--- reading stdin --" as "";
110
 
--enable_query_log
111
 
--replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR
112
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
113
 
--exec $DRIZZLE_BINLOG --short-form - < $DRIZZLE_TEST_DIR/std_data/trunc_binlog.000001
114
 
 
115
 
--replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR
116
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
117
 
--exec $DRIZZLE_BINLOG --short-form --position=79 - < $DRIZZLE_TEST_DIR/std_data/trunc_binlog.000001
118
 
drop table t1,t2;
119
 
 
120
 
#
121
 
#BUG#14157: utf8 encoding in binlog without set character_set_client
122
 
#
123
 
flush logs;
124
 
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
125
 
create table if not exists t5 (a int);
126
 
set names latin1;
127
 
create temporary table `������` (a int);
128
 
insert into `������` values (1);
129
 
insert into t5 select * from `������`
130
 
EOF
131
 
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug14157.sql
132
 
--remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
133
 
 
134
 
# resulted binlog, parly consisting of multi-byte utf8 chars, 
135
 
# must be digestable for both client and server. In 4.1 the client 
136
 
# should use default-character-set same as the server.
137
 
flush logs;
138
 
--exec $DRIZZLE_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
139
 
select * from t5  /* must be (1),(1) */;
140
 
drop table t5;
141
 
 
142
 
#
143
 
# Bug#22645 LC_TIME_NAMES: Statement not replicated
144
 
# Check that a dump created by mysqlbinlog reproduces
145
 
# lc_time_names dependent values correctly
146
 
#
147
 
flush logs;
148
 
create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
149
 
insert into t5 values (1, date_format('2001-01-01','%W'));
150
 
set lc_time_names=de_DE;
151
 
insert into t5 values (2, date_format('2001-01-01','%W'));
152
 
set lc_time_names=en_US;
153
 
insert into t5 values (3, date_format('2001-01-01','%W'));
154
 
select * from t5 order by c1;
155
 
flush logs;
156
 
drop table t5;
157
 
--exec $DRIZZLE_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
158
 
select * from t5 order by c1;
159
 
drop table t5;
160
 
 
161
 
#
162
 
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails 
163
 
#
164
 
--disable_warnings
165
 
drop procedure if exists p1;
166
 
--enable_warnings
167
 
flush logs;
168
 
delimiter //;
169
 
create procedure p1()
170
 
begin
171
 
select 1;
172
 
end;
173
 
//
174
 
delimiter ;//
175
 
flush logs;
176
 
call p1();
177
 
drop procedure p1;
178
 
--error 1305
179
 
call p1();
180
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
181
 
--exec $DRIZZLE_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008
182
 
--exec $DRIZZLE_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL
183
 
call p1();
184
 
drop procedure p1;
185
 
 
186
 
#
187
 
# Some coverage of not normally used parts
188
 
#
189
 
--disable_query_log
190
 
--exec $DRIZZLE_BINLOG --version 2>&1 > /dev/null
191
 
--exec $DRIZZLE_BINLOG --help 2>&1 > /dev/null
192
 
--enable_query_log
193
 
 
194
 
#
195
 
# Bug#15126 character_set_database is not replicated
196
 
# (LOAD DATA INFILE need it)
197
 
#
198
 
 
199
 
flush logs;
200
 
create table t1 (a varchar(64) character set utf8);
201
 
load data infile '../std_data_ln/loaddata6.dat' into table t1;
202
 
set character_set_database=koi8r;
203
 
load data infile '../std_data_ln/loaddata6.dat' into table t1;
204
 
set character_set_database=latin1;
205
 
load data infile '../std_data_ln/loaddata6.dat' into table t1;
206
 
load data infile '../std_data_ln/loaddata6.dat' into table t1;
207
 
set character_set_database=koi8r;
208
 
load data infile '../std_data_ln/loaddata6.dat' into table t1;
209
 
set character_set_database=latin1;
210
 
load data infile '../std_data_ln/loaddata6.dat' into table t1;
211
 
load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
212
 
select hex(a) from t1;
213
 
drop table t1;
214
 
flush logs;
215
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
216
 
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
217
 
--exec $DRIZZLE_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010
218
 
 
219
 
#
220
 
# Bug#28293 missed '#' sign in the hex dump when the dump length
221
 
# is divisible by 16.
222
 
#
223
 
 
224
 
CREATE TABLE t1 (c1 CHAR(10));
225
 
# we need this for getting fixed timestamps inside of this test
226
 
flush logs;
227
 
INSERT INTO t1 VALUES ('0123456789');
228
 
flush logs;
229
 
DROP TABLE t1;
230
 
--exec $DRIZZLE_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
231
 
 
232
 
#
233
 
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
234
 
#
235
 
flush logs;
236
 
create table t1(a int);
237
 
insert into t1 values(connection_id()); 
238
 
let $a= `select a from t1`;
239
 
flush logs;
240
 
--exec $DRIZZLE_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
241
 
drop table t1;
242
 
connect (con1, localhost, root, , test);                                            
243
 
connection con1;
244
 
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
245
 
--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
246
 
let $b= `select a from t1`;
247
 
disconnect con1;
248
 
connection default;
249
 
let $c= `select $a=$b`;
250
 
--echo $c
251
 
drop table t1;
252
 
 
253
 
echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
254
 
error 1;
255
 
exec $DRIZZLE_BINLOG $DRIZZLE_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
256
 
 
257
 
--echo End of 5.0 tests
258
 
 
259
 
#
260
 
# Test --disable-force-if-open and --force-if-open
261
 
#
262
 
flush logs;
263
 
--error 1
264
 
--exec $DRIZZLE_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null
265
 
--exec $DRIZZLE_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null
266
 
 
267
 
--echo BUG#31611: Security risk with BINLOG statement
268
 
 
269
 
SET BINLOG_FORMAT=ROW;
270
 
CREATE DATABASE mysqltest1;
271
 
CREATE USER untrusted@localhost;
272
 
GRANT SELECT ON mysqltest1.* TO untrusted@localhost;
273
 
 
274
 
SHOW GRANTS FOR untrusted@localhost;
275
 
USE mysqltest1;
276
 
CREATE TABLE t1 (a INT, b CHAR(64));
277
 
flush logs;
278
 
INSERT INTO t1 VALUES (1,USER());
279
 
flush logs;
280
 
echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
281
 
exec $DRIZZLE_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
282
 
connect (unsecure,localhost,untrusted,,mysqltest1);
283
 
echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql;
284
 
error 1;
285
 
exec $MYSQL mysqltest1 -uuntrusted < $MYSQLTEST_VARDIR/tmp/bug31611.sql;
286
 
connection unsecure;
287
 
error ER_TABLEACCESS_DENIED_ERROR;
288
 
INSERT INTO t1 VALUES (1,USER());
289
 
 
290
 
SELECT * FROM t1;
291
 
connection default;
292
 
DROP DATABASE mysqltest1;
293
 
DROP USER untrusted@localhost;
294
 
 
295
 
--echo BUG#32580: mysqlbinlog cannot read binlog event with user variables
296
 
 
297
 
# Testing that various kinds of events can be read and restored properly.
298
 
 
299
 
connection default;
300
 
USE test;
301
 
SET BINLOG_FORMAT = STATEMENT;
302
 
FLUSH LOGS;
303
 
CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
304
 
SET @a_real = rand(20) * 1000;
305
 
SET @an_int = 1000;
306
 
SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
307
 
SET @a_string = 'Just a test';
308
 
INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
309
 
FLUSH LOGS;
310
 
query_vertical SELECT * FROM t1;
311
 
DROP TABLE t1;
312
 
 
313
 
echo >> mysqlbinlog var/log/master-bin.000019 > var/tmp/bug32580.sql;
314
 
exec $DRIZZLE_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000019 > $MYSQLTEST_VARDIR/tmp/bug32580.sql;
315
 
echo >> mysql test < var/tmp/bug32580.sql;
316
 
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug32580.sql;
317
 
remove_file $MYSQLTEST_VARDIR/tmp/bug32580.sql;
318
 
 
319
 
query_vertical SELECT * FROM t1;
320
 
DROP TABLE t1;
321
 
 
322
 
--echo End of 5.1 tests