1
# Test that old binlog formats can be read.
3
# Some previous versions of MySQL use their own binlog format,
4
# especially in row-based replication. This test uses saved binlogs
5
# from those old versions to test that we can replicate from old
6
# versions to the present version.
8
# Replicating from old versions to new versions is necessary in an
9
# online upgrade scenario, where the .
11
# The previous versions we currently test are:
12
# - version 5.1.17 and earlier trees
13
# - mysql-5.1-wl2325-xxx trees (AKA alcatel trees)
14
# - mysql-5.1-telco-6.1 trees (AKA ndb trees)
15
# For completeness, we also test mysql-5.1-new_rpl, which is supposed
16
# to be the "correct" version.
18
# All binlogs were generated with the same commands (listed at the end
19
# of this test for reference). The binlogs contain the following
20
# events: Table_map, Write_rows, Update_rows, Delete_rows Query, Xid,
21
# User_var, Int_var, Rand, Begin_load, Append_file, Execute_load.
23
# Related bugs: BUG#27779, BUG#31581, BUG#31582, BUG#31583, BUG#32407
25
source include/not_embedded.inc;
28
DROP TABLE IF EXISTS t1, t2, t3;
31
--echo ==== Read modern binlog (version 5.1.23) ====
34
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1_23.001 | $MYSQL --local-infile=1
36
SELECT * FROM t1 ORDER BY a;
37
SELECT * FROM t2 ORDER BY a;
38
SELECT COUNT(*) FROM t3;
40
DROP TABLE t1, t2, t3;
43
--echo ==== Read binlog from version 5.1.17 ====
46
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1_17.001 | $MYSQL --local-infile=1
48
SELECT * FROM t1 ORDER BY a;
49
SELECT * FROM t2 ORDER BY a;
50
SELECT COUNT(*) FROM t3;
52
DROP TABLE t1, t2, t3;
55
--echo ==== Read binlog from version 4.1 ====
57
# In this version, neither row-based binlogging nor Xid events
58
# existed, so the binlog was generated without the "row-based tests"
59
# part and the "get xid event" part, and it does not create table t2.
62
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/binlog_old_version_4_1.000001 | $MYSQL --local-infile=1
64
SELECT * FROM t1 ORDER BY a;
65
SELECT COUNT(*) FROM t3;
70
--echo ==== Read binlog from alcatel tree (mysql-5.1-wl2325-5.0-drop6) ====
72
# In this version, it was not possible to switch between row-based and
73
# statement-based binlogging without restarting the server. So, we
74
# have two binlogs; one for row based and one for statement based
78
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-wl2325_r.001 | $MYSQL --local-infile=1
80
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-wl2325_s.001 | $MYSQL --local-infile=1
82
SELECT * FROM t1 ORDER BY a;
83
SELECT * FROM t2 ORDER BY a;
84
SELECT COUNT(*) FROM t3;
86
DROP TABLE t1, t2, t3;
89
--echo ==== Read binlog from ndb tree (mysql-5.1-telco-6.1) ====
92
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-telco.001 | $MYSQL --local-infile=1
93
# Show resulting tablea.
94
SELECT * FROM t1 ORDER BY a;
95
SELECT * FROM t2 ORDER BY a;
96
SELECT COUNT(*) FROM t3;
98
DROP TABLE t1, t2, t3;
101
#### The following commands were used to generate the binlogs ####
103
#source include/master-slave.inc;
105
## ==== initialize ====
107
#CREATE TABLE t1 (a int, b char(50)) ENGINE = MyISAM;
108
#CREATE TABLE t2 (a int, b char(50)) ENGINE = InnoDB;
109
#CREATE TABLE t3 (a char(20));
112
## ==== row based tests ====
113
#SET BINLOG_FORMAT='row';
115
## ---- get write, update, and delete rows events ----
116
#INSERT INTO t1 VALUES (0, 'one'), (1, 'two');
117
#UPDATE t1 SET a=a+1;
118
#DELETE FROM t1 WHERE a=2;
121
## ==== statement based tests ====
122
#SET BINLOG_FORMAT = 'statement';
124
## ---- get xid events ----
126
#INSERT INTO t2 VALUES (3, 'first stm in trx');
127
#INSERT INTO t1 VALUES (3, 'last stm in trx: next event should be xid');
130
## ---- get user var events ----
132
#INSERT INTO t1 VALUES (@x, 'four');
134
## ---- get rand event ----
135
#INSERT INTO t1 VALUES (RAND() * 1000000, 'random');
137
## ---- get intvar event ----
138
#INSERT INTO t1 VALUES (LAST_INSERT_ID(), 'last_insert_id');
140
## ---- get begin, append and execute load events ----
141
## double the file until we have more than 2^17 bytes, so that the
142
## event has to be split and we can use Append_file_log_event.
145
#CREATE TABLE temp (a char(20));
146
#LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE temp;
147
#INSERT INTO temp SELECT * FROM temp;
148
#INSERT INTO temp SELECT * FROM temp;
149
#INSERT INTO temp SELECT * FROM temp;
150
#INSERT INTO temp SELECT * FROM temp;
151
#INSERT INTO temp SELECT * FROM temp;
152
#INSERT INTO temp SELECT * FROM temp;
153
#INSERT INTO temp SELECT * FROM temp;
154
#INSERT INTO temp SELECT * FROM temp;
155
#SELECT a FROM temp INTO OUTFILE 'big_file.dat';
159
#LOAD DATA INFILE 'big_file.dat' INTO TABLE t3;
161
#SELECT * FROM t1 ORDER BY a;
162
#SELECT * FROM t2 ORDER BY a;
163
#SELECT COUNT(*) FROM t3;