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]
5
# we need this for getting fixed timestamps inside of this test
6
set timestamp=1000000000;
9
drop table if exists t1,t2,t3,t4,t5,t03,t04;
12
create table t1 (word varchar(20));
13
create table t2 (id int auto_increment not null primary key);
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
20
# insert into t2 values (@a);
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");
33
# delimiters are for easier debugging in future
35
select "--- Local --" as "";
39
# We should use --short-form everywhere because in other case output will
40
# be time dependend. Better than nothing.
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
47
# this should not fail but shouldn't produce any working statements
49
select "--- Broken LOAD DATA --" as "";
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
55
# this should show almost nothing
57
select "--- --database --" as "";
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
63
# this test for position option
65
select "--- --position --" as "";
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
71
# These are tests for remote binlog.
72
# They should return the same as previous test.
75
select "--- Remote --" as "";
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
85
select "--- Broken LOAD DATA --" as "";
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
91
# And this too ! (altough it is documented)
93
select "--- --database --" as "";
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
99
# Strangely but this works
101
select "--- --position --" as "";
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
107
# Bug#7853 (mysqlbinlog does not accept input from stdin)
109
select "--- reading stdin --" as "";
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
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
121
#BUG#14157: utf8 encoding in binlog without set character_set_client
124
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
125
create table if not exists t5 (a int);
127
create temporary table `������` (a int);
128
insert into `������` values (1);
129
insert into t5 select * from `������`
131
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug14157.sql
132
--remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
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.
138
--exec $DRIZZLE_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
139
select * from t5 /* must be (1),(1) */;
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
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;
157
--exec $DRIZZLE_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
158
select * from t5 order by c1;
162
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
165
drop procedure if exists p1;
169
create procedure 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
187
# Some coverage of not normally used parts
190
--exec $DRIZZLE_BINLOG --version 2>&1 > /dev/null
191
--exec $DRIZZLE_BINLOG --help 2>&1 > /dev/null
195
# Bug#15126 character_set_database is not replicated
196
# (LOAD DATA INFILE need it)
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;
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
220
# Bug#28293 missed '#' sign in the hex dump when the dump length
221
# is divisible by 16.
224
CREATE TABLE t1 (c1 CHAR(10));
225
# we need this for getting fixed timestamps inside of this test
227
INSERT INTO t1 VALUES ('0123456789');
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'
233
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
236
create table t1(a int);
237
insert into t1 values(connection_id());
238
let $a= `select a from t1`;
240
--exec $DRIZZLE_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
242
connect (con1, localhost, root, , test);
244
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
245
--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
246
let $b= `select a from t1`;
249
let $c= `select $a=$b`;
253
echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
255
exec $DRIZZLE_BINLOG $DRIZZLE_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
257
--echo End of 5.0 tests
260
# Test --disable-force-if-open and --force-if-open
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
267
--echo BUG#31611: Security risk with BINLOG statement
269
SET BINLOG_FORMAT=ROW;
270
CREATE DATABASE mysqltest1;
271
CREATE USER untrusted@localhost;
272
GRANT SELECT ON mysqltest1.* TO untrusted@localhost;
274
SHOW GRANTS FOR untrusted@localhost;
276
CREATE TABLE t1 (a INT, b CHAR(64));
278
INSERT INTO t1 VALUES (1,USER());
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;
285
exec $MYSQL mysqltest1 -uuntrusted < $MYSQLTEST_VARDIR/tmp/bug31611.sql;
287
error ER_TABLEACCESS_DENIED_ERROR;
288
INSERT INTO t1 VALUES (1,USER());
292
DROP DATABASE mysqltest1;
293
DROP USER untrusted@localhost;
295
--echo BUG#32580: mysqlbinlog cannot read binlog event with user variables
297
# Testing that various kinds of events can be read and restored properly.
301
SET BINLOG_FORMAT = STATEMENT;
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;
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);
310
query_vertical SELECT * FROM t1;
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;
319
query_vertical SELECT * FROM t1;
322
--echo End of 5.1 tests