mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / binlog / t / binlog_base64_flag.test
blob296c4bf05aad2b85bb4cf393e4824e2ff72e27d5
1 # This test case verifies that the mysqlbinlog --base64-output=X flags
2 # work as expected, and that BINLOG statements with row events fail if
3 # they are not preceded by BINLOG statements with Format description
4 # events.
6 # See also BUG#32407.
9 # BINLOG statement does not work in embedded mode.
10 source include/not_embedded.inc;
12 disable_warnings;
13 DROP TABLE IF EXISTS t1;
14 enable_warnings;
16 # Test to show BUG#32407.  This reads a binlog created with the
17 # mysql-5.1-telco-6.1 tree, specifically at the tag
18 # mysql-5.1.15-ndb-6.1.23, and applies it to the database.  The test
19 # should fail before BUG#32407 was fixed and succeed afterwards.
20 --echo ==== Test BUG#32407 ====
22 # The binlog contains row events equivalent to:
23 # CREATE TABLE t1 (a int) engine = myisam
24 # INSERT INTO t1 VALUES (1), (1)
25 exec $MYSQL_BINLOG suite/binlog/std_data/bug32407.001 | $MYSQL;
26 # The above line should succeed and t1 should contain two ones
27 select * from t1;
30 # Test that a BINLOG statement encoding a row event fails unless a
31 # Format_description_event as been supplied with an earlier BINLOG
32 # statement.
33 --echo ==== Test BINLOG statement w/o FD event ====
35 # This is a binlog statement consisting of one Table_map_log_event and
36 # one Write_rows_log_event.  Together, they correspond to the
37 # following query:
38 # INSERT INTO TABLE test.t1 VALUES (2)
40 error ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT;
41 BINLOG '
42 SVtYRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
43 SVtYRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+AgAAAA==
45 # The above line should fail and 2 should not be in the table
46 select * from t1;
49 # Test that it works to read a Format_description_log_event with a
50 # BINLOG statement, followed by a row-event in base64 from the same
51 # version.
52 --echo ==== Test BINLOG statement with FD event ====
54 # This is a binlog statement containing a Format_description_log_event
55 # from the same version as the Table_map and Write_rows_log_event.
56 BINLOG '
57 ODdYRw8BAAAAZgAAAGoAAAABAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
58 AAAAAAAAAAAAAAAAAAA4N1hHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
61 # This is a Table_map_log_event+Write_rows_log_event corresponding to:
62 # INSERT INTO TABLE test.t1 VALUES (3)
63 BINLOG '
64 TFtYRxMBAAAAKQAAAH8BAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
65 TFtYRxcBAAAAIgAAAKEBAAAQABAAAAAAAAEAAf/+AwAAAA==
67 # The above line should succeed and 3 should be in the table
68 select * from t1;
71 # Test that mysqlbinlog stops with an error message when the
72 # --base64-output=never flag is used on a binlog with base64 events.
73 --echo ==== Test --base64-output=never on a binlog with row events ====
75 # mysqlbinlog should fail
76 --replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] .*/<#>/   /SET \@\@session.pseudo_thread_id.*/<#>/
77 error 1;
78 exec $MYSQL_BINLOG --base64-output=never suite/binlog/std_data/bug32407.001;
79 # the above line should output the query log event and then stop
82 # Test that the following fails cleanly: "First, read a
83 # Format_description event which has N event types. Then, read an
84 # event of type M>N"
85 --echo ==== Test non-matching FD event and Row event ====
87 # This is the Format_description_log_event from
88 # bug32407.001, encoded in base64. It contains only the old
89 # row events (number of event types is 22)
90 BINLOG '
91 4CdYRw8BAAAAYgAAAGYAAAAAAAQANS4xLjE1LW5kYi02LjEuMjQtZGVidWctbG9nAAAAAAAAAAAA
92 AAAAAAAAAAAAAAAAAADgJ1hHEzgNAAgAEgAEBAQEEgAATwAEGggICAg=
95 # The following is a Write_rows_log_event with event type 23, i.e.,
96 # not supported by the Format_description_log_event above.  It
97 # corresponds to the following query:
98 # INSERT INTO t1 VALUES (5)
99 error 1149;
100 BINLOG '
101 Dl1YRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
102 Dl1YRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+BQAAAA==
104 # the above line should fail and 5 should not be in the binlog.
105 select * from t1;
107 # Test that BUG#37426 is triggered.
109 CREATE TABLE char128_utf8 ( 
110     i1 INT NOT NULL, 
111     c CHAR(128) CHARACTER SET utf8 NOT NULL, 
112     i2 INT NOT NULL);
113 CREATE TABLE char63_utf8 (
114       i1 INT NOT NULL,
115       c CHAR(63) CHARACTER SET utf8 NOT NULL,
116       i2 INT NOT NULL);
119 # This is the format description log event
122 BINLOG '
123 MuNkSA8BAAAAZgAAAGoAAAAAAAQANS4xLjI1LXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
124 AAAAAAAAAAAAAAAAAAAy42RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
127 # ... this event corresponding to
129 #    INSERT INTO char63_utf8 VALUES ( 1, "123", 1 )
131 # The binlog event below shall not trigger the bug check
133 BINLOG '
134 3u9kSBMBAAAANgAAAJYBAAAAABAAAAAAAAAABHRlc3QAC2NoYXI2M191dGY4AAMD/gMC/r0A
135 3u9kSBcBAAAAKgAAAMABAAAQABAAAAAAAAEAA//4AQAAAAMxMjMBAAAA
137 SELECT * FROM char63_utf8;
139 # ... and this is an event corresponding to
141 #    INSERT INTO char128_utf8 VALUES ( 1, "123", 1 )
143 # The binlog event below shall trigger the bug check and produce an error
146 error ER_UNKNOWN_ERROR;
147 BINLOG '
148 iONkSBMBAAAANwAAAJkBAAAAABAAAAAAAAAABHRlc3QADGNoYXIxMjhfdXRmOAADA/4DAv6AAA==
149 iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
152 drop table t1, char63_utf8, char128_utf8;
154 call mtr.add_suppression("Slave SQL.*master suffers from this bug: http:..bugs.mysql.com.bug.php.id=37426.* Error_code: 1105");
155 call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
157 --echo #
158 --echo # Bug #54393: crash and/or valgrind errors in 
159 --echo # mysql_client_binlog_statement
160 --echo #
161 --error ER_SYNTAX_ERROR
162 BINLOG '';
163 BINLOG '123';
164 --error ER_SYNTAX_ERROR
165 BINLOG '-2079193929';
166 --error ER_SYNTAX_ERROR
167 BINLOG 'xç↓%~∙D╒ƒ╡';