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
9 # BINLOG statement does not work in embedded mode.
10 source include/not_embedded.inc;
13 DROP TABLE IF EXISTS t1;
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
30 # Test that a BINLOG statement encoding a row event fails unless a
31 # Format_description_event as been supplied with an earlier BINLOG
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
38 # INSERT INTO TABLE test.t1 VALUES (2)
40 error ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT;
42 SVtYRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
43 SVtYRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+AgAAAA==
45 # The above line should fail and 2 should not be in the table
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
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.
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)
64 TFtYRxMBAAAAKQAAAH8BAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
65 TFtYRxcBAAAAIgAAAKEBAAAQABAAAAAAAAEAAf/+AwAAAA==
67 # The above line should succeed and 3 should be in the table
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.*/<#>/
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
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)
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)
101 Dl1YRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
102 Dl1YRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+BQAAAA==
104 # the above line should fail and 5 should not be in the binlog.
107 # Test that BUG#37426 is triggered.
109 CREATE TABLE char128_utf8 (
111 c CHAR(128) CHARACTER SET utf8 NOT NULL,
113 CREATE TABLE char63_utf8 (
115 c CHAR(63) CHARACTER SET utf8 NOT NULL,
119 # This is the format description log event
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
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;
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");
158 --echo # Bug #54393: crash and/or valgrind errors in
159 --echo # mysql_client_binlog_statement
161 --error ER_SYNTAX_ERROR
164 --error ER_SYNTAX_ERROR
165 BINLOG '-2079193929';
166 --error ER_SYNTAX_ERROR