Debian Codegraph @

mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test

raw
1 -- source include/have_binlog_format_row.inc
2 #
3 # Reset master to cleanup binlog
4 #
5 reset master;
6
7 #
8 # Write different events to binlog
9 #
10 create table t1 (a int);
11 insert into t1 values (1);
12 insert into t1 values (2);
13 insert into t1 values (3);
14 update t1 set a=a+2 where a=2;
15 update t1 set a=a+2 where a=3;
16
17 create table t2 (word varchar(20));
18 load data infile '../../std_data/words.dat' into table t2;
19
20 #
21 # Save binlog
22 #
23 let $MYSQLD_DATADIR=`select @@datadir`;
24 flush 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 #
30 drop table t1;
31 drop table t2;
32 --exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
33
34 #
35 # Verify that all binlog events have been executed
36 #
37 select * from t1;
38 select * from t2;
39
40 #
41 # Verify that events larger than the default IO_CACHE buffer
42 # are handled correctly (BUG#25628).
43 #
44 flush logs;
45 drop table t2;
46 create table t2 (word varchar(20));
47 load data infile '../../std_data/words.dat' into table t2;
48 insert into t2 select * from t2;
49 insert into t2 select * from t2;
50 insert into t2 select * from t2;
51 insert into t2 select * from t2;
52 insert into t2 select * from t2;
53 insert into t2 select * from t2;
54 insert into t2 select * from t2;
55 insert into t2 select * from t2;
56 insert into t2 select * from t2;
57 select count(*) from t2;
58
59 flush 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 #
66 select count(*) from t2;
67
68 #
69 # Test cleanup
70 #
71 --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
72 drop table t1;
73 drop 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
83 RESET MASTER;
84 USE test;
85 SET @old_binlog_format= @@binlog_format;
86 SET SESSION binlog_format=ROW;
87 CREATE 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
92 INSERT INTO t1 VALUES (1);
93
94 FLUSH 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
100 DROP TABLE t1;
101 SET SESSION binlog_format= @old_binlog_format;
102 RESET MASTER;