mirror of
https://github.com/MariaDB/server.git
synced 2025-12-10 19:44:09 +03:00
Main problem was that no log-event print function checked for disk full error on the IO_CACHE. All changes in this patch only affects mysqlbinlog, not the server! - Changed all log-event print functions to return 1 on error - Fixed memory usage when not using --flashback. - Added printing of number of rows in row events. Can be disabled with --print-row-count=0 - Print annotated rows when using mysqlbinlog --short-form - Fixed that mysqlbinlog --debug works - Fixed create_drop_binlog.test test failure - Reorganized fields in PRINT_EVENT_INFO to be according to size to optimize storage - Don't change print_row_event_position or print_row_counts if set by user - Remove some testing of argument to my_free is 0 - base64-output=never is now supported and works in all context - Updated help information for --base64-output and --short-form - print_row_count is now on by default. Reset automatically if --short-form is used - Removed obsolote warning for mysql 5.6.0 - More DBUG_PRINT for mysqltest.cc - my_b_write_byte() now checks for flush failures. This fixed a memory overrun on disk full - my_b_printf() now returns 1 on failure, 0 on ok. This simplifies code and no old code was using the old return value of my_b_printf(). - my_b_Write_backtick_quote() now returns 1 on failure and 0 on ok - Fixed some error conditions in log printing that was not previously handled. - Slave_rows_error_report() can now handle longlong positions - Write_on_release_cache() rewritten so that we can detect errors on flush. Not depending on automatic release anymore. - Changed types for Pos and End_log_pos to 64 bit in SHOW BINLOG EVENTS - Fixed that copy_event_cache_to_string_and_reinit() works with strings longer than 4G (Changed to use LEX_STRING instead of String) - Restricted binlog_rows_event_max_size to UINT32_MAX-1 as String's are anyway restricted to UINT32_MAX - Fixed bug in rpl_binlog_state::write_to_iocache() which hide write failures (duplicate variable name) - Fixed bug in String::append if original string was not allocated - Stop mysqlbinlog output at once if there is an error. - Before printing error message, flush result file. This ensures that the error message is printed last. (Easier to find)
167 lines
5.4 KiB
Plaintext
167 lines
5.4 KiB
Plaintext
# This test case verifies that the mysqlbinlog --base64-output=X flags
|
|
# work as expected, and that BINLOG statements with row events fail if
|
|
# they are not preceded by BINLOG statements with Format description
|
|
# events.
|
|
#
|
|
# See also BUG#32407.
|
|
|
|
|
|
# BINLOG statement does not work in embedded mode.
|
|
source include/not_embedded.inc;
|
|
|
|
disable_warnings;
|
|
DROP TABLE IF EXISTS t1;
|
|
enable_warnings;
|
|
|
|
# Test to show BUG#32407. This reads a binlog created with the
|
|
# mysql-5.1-telco-6.1 tree, specifically at the tag
|
|
# mysql-5.1.15-ndb-6.1.23, and applies it to the database. The test
|
|
# should fail before BUG#32407 was fixed and succeed afterwards.
|
|
--echo ==== Test BUG#32407 ====
|
|
|
|
# The binlog contains row events equivalent to:
|
|
# CREATE TABLE t1 (a int) engine = myisam
|
|
# INSERT INTO t1 VALUES (1), (1)
|
|
exec $MYSQL_BINLOG suite/binlog/std_data/bug32407.001 | $MYSQL;
|
|
# The above line should succeed and t1 should contain two ones
|
|
select * from t1;
|
|
|
|
|
|
# Test that a BINLOG statement encoding a row event fails unless a
|
|
# Format_description_event as been supplied with an earlier BINLOG
|
|
# statement.
|
|
--echo ==== Test BINLOG statement w/o FD event ====
|
|
|
|
# This is a binlog statement consisting of one Table_map_log_event and
|
|
# one Write_rows_log_event. Together, they correspond to the
|
|
# following query:
|
|
# INSERT INTO TABLE test.t1 VALUES (2)
|
|
|
|
error ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT;
|
|
BINLOG '
|
|
SVtYRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
|
|
SVtYRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+AgAAAA==
|
|
';
|
|
# The above line should fail and 2 should not be in the table
|
|
select * from t1;
|
|
|
|
|
|
# Test that it works to read a Format_description_log_event with a
|
|
# BINLOG statement, followed by a row-event in base64 from the same
|
|
# version.
|
|
--echo ==== Test BINLOG statement with FD event ====
|
|
|
|
# This is a binlog statement containing a Format_description_log_event
|
|
# from the same version as the Table_map and Write_rows_log_event.
|
|
BINLOG '
|
|
ODdYRw8BAAAAZgAAAGoAAAABAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
|
|
AAAAAAAAAAAAAAAAAAA4N1hHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
|
';
|
|
|
|
# This is a Table_map_log_event+Write_rows_log_event corresponding to:
|
|
# INSERT INTO TABLE test.t1 VALUES (3)
|
|
BINLOG '
|
|
TFtYRxMBAAAAKQAAAH8BAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
|
|
TFtYRxcBAAAAIgAAAKEBAAAQABAAAAAAAAEAAf/+AwAAAA==
|
|
';
|
|
# The above line should succeed and 3 should be in the table
|
|
select * from t1;
|
|
|
|
|
|
# New mysqlbinlog supports --base64-output=never
|
|
--echo ==== Test --base64-output=never on a binlog with row events ====
|
|
|
|
# mysqlbinlog should fail
|
|
--replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] \N*/<#>/ /SET \@\@session.pseudo_thread_id.*/<#>/
|
|
exec $MYSQL_BINLOG --base64-output=never --print-row-count=0 --print-row-event-positions=0 suite/binlog/std_data/bug32407.001;
|
|
|
|
|
|
# Test that the following fails cleanly: "First, read a
|
|
# Format_description event which has N event types. Then, read an
|
|
# event of type M>N"
|
|
--echo ==== Test non-matching FD event and Row event ====
|
|
|
|
# This is the Format_description_log_event from
|
|
# bug32407.001, encoded in base64. It contains only the old
|
|
# row events (number of event types is 22)
|
|
BINLOG '
|
|
4CdYRw8BAAAAYgAAAGYAAAAAAAQANS4xLjE1LW5kYi02LjEuMjQtZGVidWctbG9nAAAAAAAAAAAA
|
|
AAAAAAAAAAAAAAAAAADgJ1hHEzgNAAgAEgAEBAQEEgAATwAEGggICAg=
|
|
';
|
|
|
|
# The following is a Write_rows_log_event with event type 23, i.e.,
|
|
# not supported by the Format_description_log_event above. It
|
|
# corresponds to the following query:
|
|
# INSERT INTO t1 VALUES (5)
|
|
error 1149;
|
|
BINLOG '
|
|
Dl1YRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
|
|
Dl1YRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+BQAAAA==
|
|
';
|
|
# the above line should fail and 5 should not be in the binlog.
|
|
select * from t1;
|
|
|
|
# Test that BUG#37426 is triggered.
|
|
|
|
CREATE TABLE char128_utf8 (
|
|
i1 INT NOT NULL,
|
|
c CHAR(128) CHARACTER SET utf8 NOT NULL,
|
|
i2 INT NOT NULL);
|
|
CREATE TABLE char63_utf8 (
|
|
i1 INT NOT NULL,
|
|
c CHAR(63) CHARACTER SET utf8 NOT NULL,
|
|
i2 INT NOT NULL);
|
|
|
|
#
|
|
# This is the format description log event
|
|
#
|
|
|
|
BINLOG '
|
|
MuNkSA8BAAAAZgAAAGoAAAAAAAQANS4xLjI1LXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
|
|
AAAAAAAAAAAAAAAAAAAy42RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
|
';
|
|
|
|
# ... this event corresponding to
|
|
#
|
|
# INSERT INTO char63_utf8 VALUES ( 1, "123", 1 )
|
|
#
|
|
# The binlog event below shall not trigger the bug check
|
|
|
|
BINLOG '
|
|
3u9kSBMBAAAANgAAAJYBAAAAABAAAAAAAAAABHRlc3QAC2NoYXI2M191dGY4AAMD/gMC/r0A
|
|
3u9kSBcBAAAAKgAAAMABAAAQABAAAAAAAAEAA//4AQAAAAMxMjMBAAAA
|
|
';
|
|
SELECT * FROM char63_utf8;
|
|
|
|
# ... and this is an event corresponding to
|
|
#
|
|
# INSERT INTO char128_utf8 VALUES ( 1, "123", 1 )
|
|
#
|
|
# The binlog event below shall trigger the bug check and produce an error
|
|
#
|
|
|
|
error ER_UNKNOWN_ERROR;
|
|
BINLOG '
|
|
iONkSBMBAAAANwAAAJkBAAAAABAAAAAAAAAABHRlc3QADGNoYXIxMjhfdXRmOAADA/4DAv6AAA==
|
|
iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
|
|
';
|
|
|
|
drop table t1, char63_utf8, char128_utf8;
|
|
|
|
call mtr.add_suppression("Slave SQL.*master suffers from this bug: http:..bugs.mysql.com.bug.php.id=37426.* error.* 1105");
|
|
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* error.* 1535");
|
|
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.char128_utf8. cannot be converted.* error.* 1677");
|
|
|
|
--echo #
|
|
--echo # Bug #54393: crash and/or valgrind errors in
|
|
--echo # mysql_client_binlog_statement
|
|
--echo #
|
|
--error ER_SYNTAX_ERROR
|
|
BINLOG '';
|
|
--error ER_BASE64_DECODE_ERROR
|
|
BINLOG '123';
|
|
--error ER_BASE64_DECODE_ERROR
|
|
BINLOG '-2079193929';
|
|
--error ER_BASE64_DECODE_ERROR
|
|
BINLOG 'xç↓%~∙D╒ƒ╡';
|