Commit a539fac8 authored by Nikita Malyavin's avatar Nikita Malyavin Committed by Sergei Golubchik

MDEV-31646 untie from max_allowed_packet and opt_binlog_rows_event_max_size

parent d5e59c98
......@@ -761,17 +761,13 @@ Log_event::Log_event(const uchar *buf,
int Log_event::read_log_event(IO_CACHE* file, String* packet,
const Format_description_log_event *fdle,
enum enum_binlog_checksum_alg checksum_alg_arg)
enum enum_binlog_checksum_alg checksum_alg_arg,
size_t max_allowed_packet)
{
ulong data_len;
char buf[LOG_EVENT_MINIMAL_HEADER_LEN];
uchar ev_offset= packet->length();
#if !defined(MYSQL_CLIENT)
THD *thd=current_thd;
ulong max_allowed_packet= thd ? thd->slave_thread ? slave_max_allowed_packet
: thd->variables.max_allowed_packet
: ~(uint)0;
#endif
DBUG_ENTER("Log_event::read_log_event(IO_CACHE*,String*...)");
if (my_b_read(file, (uchar*) buf, sizeof(buf)))
......@@ -882,7 +878,8 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
Log_event* Log_event::read_log_event(IO_CACHE* file,
const Format_description_log_event *fdle,
my_bool crc_check)
my_bool crc_check,
size_t max_allowed_packet)
{
DBUG_ENTER("Log_event::read_log_event(IO_CACHE*,Format_description_log_event*...)");
DBUG_ASSERT(fdle != 0);
......@@ -890,7 +887,8 @@ Log_event* Log_event::read_log_event(IO_CACHE* file,
const char *error= 0;
Log_event *res= 0;
switch (read_log_event(file, &event, fdle, BINLOG_CHECKSUM_ALG_OFF))
switch (read_log_event(file, &event, fdle, BINLOG_CHECKSUM_ALG_OFF,
max_allowed_packet))
{
case 0:
break;
......
......@@ -1363,6 +1363,20 @@ class Log_event
#endif
#endif
private:
static size_t get_max_packet()
{
size_t max_packet= ~0UL;
#if !defined(MYSQL_CLIENT)
THD *thd=current_thd;
if (thd)
max_packet= thd->slave_thread ? slave_max_allowed_packet
: thd->variables.max_allowed_packet;
#endif
return max_packet;
}
public:
/*
read_log_event() functions read an event from a binlog or relay
log; used by SHOW BINLOG EVENTS, the binlog_dump thread on the
......@@ -1377,7 +1391,15 @@ class Log_event
static Log_event* read_log_event(IO_CACHE* file,
const Format_description_log_event
*description_event,
my_bool crc_check);
my_bool crc_check,
size_t max_allowed_packet);
static Log_event* read_log_event(IO_CACHE* file,
const Format_description_log_event
*description_event,
my_bool crc_check)
{
return read_log_event(file, description_event, crc_check, get_max_packet());
}
/**
Reads an event from a binlog or relay log. Used by the dump thread
......@@ -1404,7 +1426,16 @@ class Log_event
*/
static int read_log_event(IO_CACHE* file, String* packet,
const Format_description_log_event *fdle,
enum enum_binlog_checksum_alg checksum_alg_arg);
enum enum_binlog_checksum_alg checksum_alg_arg,
size_t max_allowed_packet);
static int read_log_event(IO_CACHE* file, String* packet,
const Format_description_log_event *fdle,
enum enum_binlog_checksum_alg checksum_alg)
{
return read_log_event(file, packet, fdle, checksum_alg, get_max_packet());
}
/*
The value is set by caller of FD constructor and
Log_event::write_header() for the rest.
......
......@@ -11665,7 +11665,7 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
do
{
const auto *descr_event= rgi->rli->relay_log.description_event_for_exec;
auto *ev= Log_event::read_log_event(log_file, descr_event, false);
auto *ev= Log_event::read_log_event(log_file, descr_event, false, ~0UL);
error= log_file->error;
if (unlikely(!ev))
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment