summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqlbinlog_base64.test
blob: 2d8a111d2ea531bb10df5d4b1e34a3d8afb4e53e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-- source include/have_binlog_format_row.inc
#
#  Write different events to binlog
#
create table t1 (a int);
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
update t1 set a=a+2 where a=2;
update t1 set a=a+2 where a=3;

create table t2 (word varchar(20));
load data infile '../../std_data/words.dat' into table t2;

#
#  Save binlog
#
let $MYSQLD_DATADIR=`select @@datadir`;
flush logs;
--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql

#
#  Clear database and restore from binlog
#
drop table t1;
drop table t2;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql

#
#  Verify that all binlog events have been executed
#
select * from t1;
select * from t2;

# DEBUG CODE ADDED BY SVEN. BUG#38127
let $count_t1= `SELECT COUNT(*) FROM t1`;
let $count_t2= `SELECT COUNT(*) FROM t2`;
if (`SELECT $count_t1 != 3 OR $count_t2 != 70`)
{
  --echo Test case bug! See BUG#38127. Printing debug info.
  --cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
  SHOW MASTER STATUS;
  SHOW BINLOG EVENTS;
  --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001
  SHOW TABLES;
  exit;
}
# END DEBUG CODE

#
#  Verify that events larger than the default IO_CACHE buffer
#  are handled correctly (BUG#25628).
#
flush logs;
drop table t2;
create table t2 (word varchar(20));
load data infile '../../std_data/words.dat' into table t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
select count(*) from t2;

flush logs;
--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql

#
#  Verify that all binlog events have been executed
#
select count(*) from t2;

#
#  Test cleanup
#
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
drop table t1;
drop table t2;