1-- source include/have_binlog_format_row.inc
2#
3# Reset master to cleanup binlog
4#
5reset master;
6
7#
8#  Write different events to binlog
9#
10create table t1 (a int);
11insert into t1 values (1);
12insert into t1 values (2);
13insert into t1 values (3);
14update t1 set a=a+2 where a=2;
15update t1 set a=a+2 where a=3;
16
17create table t2 (word varchar(20));
18load data infile '../../std_data/words.dat' into table t2;
19
20#
21#  Save binlog
22#
23let $MYSQLD_DATADIR=`select @@datadir`;
24flush logs;
25--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
26
27#
28#  Clear database and restore from binlog
29#
30drop table t1;
31drop table t2;
32--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
33
34#
35#  Verify that all binlog events have been executed
36#
37select * from t1;
38select * from t2;
39
40#
41#  Verify that events larger than the default IO_CACHE buffer
42#  are handled correctly (BUG#25628).
43#
44flush logs;
45drop table t2;
46create table t2 (word varchar(20));
47load data infile '../../std_data/words.dat' into table t2;
48insert into t2 select * from t2;
49insert into t2 select * from t2;
50insert into t2 select * from t2;
51insert into t2 select * from t2;
52insert into t2 select * from t2;
53insert into t2 select * from t2;
54insert into t2 select * from t2;
55insert into t2 select * from t2;
56insert into t2 select * from t2;
57select count(*) from t2;
58
59flush logs;
60--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
61--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
62
63#
64#  Verify that all binlog events have been executed
65#
66select count(*) from t2;
67
68#
69#  Test cleanup
70#
71--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
72drop table t1;
73drop table t2;
74
75#
76# BUG#12354268
77#
78# This test verifies that using --start-position with DECODE-ROWS
79# does not make mysqlbinlog to output an error stating that it
80# does not contain any FD event.
81#
82
83RESET MASTER;
84USE test;
85SET @old_binlog_format= @@binlog_format;
86SET SESSION binlog_format=ROW;
87CREATE TABLE t1(c1 INT);
88--let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
89--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
90--let $MYSQLD_DATADIR= `SELECT @@datadir`
91
92INSERT INTO t1 VALUES (1);
93
94FLUSH LOGS;
95
96--disable_result_log
97--exec $MYSQL_BINLOG --base64-output=DECODE-ROWS --start-position=$master_pos -v $MYSQLD_DATADIR/$master_binlog
98--enable_result_log
99
100DROP TABLE t1;
101SET SESSION binlog_format= @old_binlog_format;
102RESET MASTER;
103