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.