Debian Codegraph @

mysql-test/suite/binlog_nogtid/t/binlog_old_versions.test

raw
1 # Test that old binlog formats can be read.
2
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.
7
8 # Replicating from old versions to new versions is necessary in an
9 # online upgrade scenario, where the .
10
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.
17
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.
22
23 # Related bugs: BUG#27779, BUG#31581, BUG#31582, BUG#31583, BUG#32407
24
25 # It is required to supress BUG#21816447. It should be removed
26 # after the bug is fixed.
27 --source include/have_binlog_format_row.inc
28
29 # Applies a binlog that was generated with GTID_MODE=OFF
30
31 source include/no_valgrind_without_big.inc;
32
33 --echo ==== Read binlog with v2 row events ====
34
35 # Read binlog.
36 --exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_trunk_row_v2.001 | $MYSQL --local-infile=1
37 # Show result.
38 SELECT * FROM t1 ORDER BY a;
39 SELECT * FROM t2 ORDER BY a;
40 SELECT COUNT(*) FROM t3;
41 # Reset.
42 DROP TABLE t1, t2, t3;
43
44
45 --echo ==== Read modern binlog (version 5.1.23) ====
46
47 # Read binlog.
48 --exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1_23.001 | $MYSQL --local-infile=1
49 # Show result.
50 SELECT * FROM t1 ORDER BY a;
51 SELECT * FROM t2 ORDER BY a;
52 SELECT COUNT(*) FROM t3;
53 # Reset.
54 DROP TABLE t1, t2, t3;
55
56
57 --echo *** wl#2540 Replication events checksum is not yet defined
58 --echo *** its born-version. One that is temporarily chosen conflicts with
59 --echo *** the version in the following pre-recorded binlogs
60 --echo *** TODO: uncomment this snippet when the WL patches will be about to push
61
62 --echo ==== Read binlog from alcatel tree (mysql-5.1-wl2325-5.0-drop6) ====
63
64 # In this version, it was not possible to switch between row-based and
65 # statement-based binlogging without restarting the server. So, we
66 # have two binlogs; one for row based and one for statement based
67 # replication.
68
69 # Read rbr binlog.
70 # --exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-wl2325_r.001 | $MYSQL --local-infile=1
71 # # Read stm binlog.
72 # --exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-wl2325_s.001 | $MYSQL --local-infile=1
73 # # Show result.
74 # SELECT * FROM t1 ORDER BY a;
75 # SELECT * FROM t2 ORDER BY a;
76 # SELECT COUNT(*) FROM t3;
77 # # Reset.
78 # DROP TABLE t1, t2, t3;
79
80
81 #### The following commands were used to generate the binlogs ####
82 #
83 #source include/master-slave.inc;
84 #
85 ## ==== initialize ====
86 #USE test;
87 #CREATE TABLE t1 (a int, b char(50)) ENGINE = MyISAM;
88 #CREATE TABLE t2 (a int, b char(50)) ENGINE = InnoDB;
89 #CREATE TABLE t3 (a char(20));
90 #
91 #
92 ## ==== row based tests ====
93 #SET BINLOG_FORMAT='row';
94 #
95 ## ---- get write, update, and delete rows events ----
96 #INSERT INTO t1 VALUES (0, 'one'), (1, 'two');
97 #UPDATE t1 SET a=a+1;
98 #DELETE FROM t1 WHERE a=2;
99 #
100 #
101 ## ==== statement based tests ====
102 #SET BINLOG_FORMAT = 'statement';
103 #
104 ## ---- get xid events ----
105 #BEGIN;
106 #INSERT INTO t2 VALUES (3, 'first stm in trx');
107 #INSERT INTO t1 VALUES (3, 'last stm in trx: next event should be xid');
108 #COMMIT;
109 #
110 ## ---- get user var events ----
111 #SET @x = 4;
112 #INSERT INTO t1 VALUES (@x, 'four');
113 #
114 ## ---- get rand event ----
115 #INSERT INTO t1 VALUES (RAND() * 1000000, 'random');
116 #
117 ## ---- get intvar event ----
118 #INSERT INTO t1 VALUES (LAST_INSERT_ID(), 'last_insert_id');
119 #
120 ## ---- get begin, append and execute load events ----
121 ## double the file until we have more than 2^17 bytes, so that the
122 ## event has to be split and we can use Append_file_log_event.
123 #
124 #SET SQL_LOG_BIN=0;
125 #CREATE TABLE temp (a char(20));
126 #LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE temp;
127 #INSERT INTO temp SELECT * FROM temp;
128 #INSERT INTO temp SELECT * FROM temp;
129 #INSERT INTO temp SELECT * FROM temp;
130 #INSERT INTO temp SELECT * FROM temp;
131 #INSERT INTO temp SELECT * FROM temp;
132 #INSERT INTO temp SELECT * FROM temp;
133 #INSERT INTO temp SELECT * FROM temp;
134 #INSERT INTO temp SELECT * FROM temp;
135 #SELECT a FROM temp INTO OUTFILE 'big_file.dat';
136 #DROP TABLE temp;
137 #SET SQL_LOG_BIN=1;
138 #
139 #LOAD DATA INFILE 'big_file.dat' INTO TABLE t3;
140 #
141 #SELECT * FROM t1 ORDER BY a;
142 #SELECT * FROM t2 ORDER BY a;
143 #SELECT COUNT(*) FROM t3;
144 # Cleanup
145 #--source include/rpl_end.inc
146 --remove_files_wildcard $MYSQLTEST_VARDIR/tmp SQL_LOAD_MB*