1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

MDEV-4645: Incorrect reads of frozen binlog events; FDE corrupted in relay log

Currently several places use description_event->common_header_len instead of
  LOG_EVENT_MINIMAL_HEADER_LEN when parsing events with "frozen" headers (such
  as Start_event_v3 and its subclasses such as Format_description_log_event, as
  well as Rotate_event). This causes events with extra headers (which would otherwise
  be valid and those headers ignored) to be corrupted due to over-reading or skipping
  into the data portion of the log events.
  
  It is rewritten in some details patch of Jeremy Cole (See MDEV):
  - The virtual function returns length to avoid IFs (and only one call of the virtual function made)
  - Printing function avoids printing strings
This commit is contained in:
unknown
2013-09-12 21:36:58 +03:00
parent ada15c7a0f
commit 7a80c534ad
8 changed files with 538 additions and 91 deletions

View File

@@ -275,17 +275,16 @@ FLUSH LOGS;
DROP TABLE t1;
# We create a table, patch, and load the output into it
# By using LINES STARTING BY '#' + SELECT WHERE a LIKE 'Query'
# We can easily see if a 'Query' line is missing the '#' character
# as described in the original bug
# We create a table named "patch", and load the output into it.
# By using LIKE, we can easily see if the output is missing the '#'
# character, as described in the bug.
--disable_query_log
CREATE TABLE patch (a BLOB);
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
### Starting master-bin.000014
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
INTO TABLE patch FIELDS TERMINATED BY '' LINES STARTING BY '#';
INTO TABLE patch FIELDS TERMINATED BY '';
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log
@@ -293,7 +292,7 @@ eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
--echo The bug being tested was that 'Query' lines were not preceded by '#'
--echo If the line is in the table, it had to have been preceded by a '#'
--echo
SELECT COUNT(*) AS `BUG#28293_expect_2` FROM patch WHERE a LIKE '%Query%';
SELECT COUNT(*) AS `BUG#28293_expect_2` FROM patch WHERE a LIKE '#%Query%';
DROP TABLE patch;
#
@@ -594,3 +593,12 @@ SHOW TABLES IN test;
--exec $MYSQL_BINLOG --server-id=2 $MYSQLD_DATADIR/$master_binlog | $MYSQL
SHOW TABLES IN test;
eval SET GLOBAL SERVER_ID = $old_server_id;
--echo #
--echo # MDEV-4645: Incorrect reads of frozen binlog events;
--echo # FDE corrupted in relay log
--echo #
--exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_checksum.binlog
--exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id.binlog
--exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id_checksum.binlog
--exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_none.binlog