Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions mysql-test/main/mysqlbinlog_force_read_truncated.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# MDEV-40545: --force-read must not loop on a truncated event
#
# The event header is truncated
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ERROR: Error in Log_event::read_log_event(): 'Event truncated'
ERROR: Could not read entry at offset 4: Error in log format or read error.
# The event body is truncated
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ERROR: Error in Log_event::read_log_event(): 'Event truncated', data_len: 94, event_type: 15
ERROR: Could not read entry at offset 4: Error in log format or read error.
# End of 11.4 tests
13 changes: 13 additions & 0 deletions mysql-test/main/mysqlbinlog_force_read_truncated.test
Comment thread
ParadoxV5 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--echo #
--echo # MDEV-40545: --force-read must not loop on a truncated event
--echo #

--echo # The event header is truncated
--error 1
--exec $MYSQL_BINLOG --short-form --force-read $MYSQL_TEST_DIR/std_data/truncated_binlog_header.000001 2>&1

--echo # The event body is truncated
--error 1
--exec $MYSQL_BINLOG --short-form --force-read $MYSQL_TEST_DIR/std_data/truncated_binlog_body.000001 2>&1

--echo # End of 11.4 tests
Binary file added mysql-test/std_data/truncated_binlog_body.000001
Comment thread
ParadoxV5 marked this conversation as resolved.
Binary file not shown.
Binary file added mysql-test/std_data/truncated_binlog_header.000001
Comment thread
ParadoxV5 marked this conversation as resolved.
Binary file not shown.
9 changes: 4 additions & 5 deletions sql/log_event.cc
Comment thread
ParadoxV5 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,10 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, int *out_error,
error= "Event too big";
goto err;
case LOG_READ_DECRYPT:
#ifdef MYSQL_CLIENT
if (force_opt)
DBUG_RETURN(new Unknown_log_event());
#endif
error= "Event decryption failure";
goto err;
case LOG_READ_CHECKSUM_FAILURE:
Expand All @@ -956,11 +960,6 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, int *out_error,
if (unlikely(error))
{
DBUG_ASSERT(!res);
#ifdef MYSQL_CLIENT
if (force_opt)
DBUG_RETURN(new Unknown_log_event());
#endif

/*
The SQL slave thread will check *out_error to know
if there was an I/O error. Even if there is no "low-level" I/O errors
Expand Down