1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36810 Deduplicate LOG_EVENT_OFFSET

`LOG_EVENT_OFFSET` is a duplicate of `EVENT_TYPE_OFFSET`
and `BIN_LOG_HEADER_SIZE` depending on the context.

While there, centralize `BIN_LOG_HEADER_SIZE` to `sql/rpl_constants.h`
(previously from `sql/unireg.h` and `client/mysqlbinlog.cc`)

Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
This commit is contained in:
ParadoxV5
2025-07-23 09:45:19 -06:00
parent 46d7450f75
commit 20bb4ed882
6 changed files with 21 additions and 18 deletions

View File

@@ -2261,7 +2261,9 @@ send_event_to_slave(binlog_send_info *info, Log_event_type event_type,
return "Failed on my_net_write()";
}
DBUG_PRINT("info", ("log event code %d", (*packet)[LOG_EVENT_OFFSET+1] ));
DBUG_PRINT("info", ("log event code %d",
(*packet)[/* Replication protocol status byte */ 1 + EVENT_TYPE_OFFSET]
));
if (event_type == LOAD_EVENT)
{
if (send_file(info->thd))
@@ -2528,7 +2530,9 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
DBUG_RETURN(1);
}
event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
event_type= static_cast<Log_event_type>(
static_cast<unsigned char>((*packet)[ev_offset + EVENT_TYPE_OFFSET])
);
/*
The packet has offsets equal to the normal offsets in a
@@ -2663,7 +2667,9 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
DBUG_RETURN(1);
}
event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET + ev_offset]);
event_type= static_cast<Log_event_type>(
static_cast<unsigned char>((*packet)[ev_offset + EVENT_TYPE_OFFSET])
);
if (event_type == START_ENCRYPTION_EVENT)
{
Start_encryption_log_event *sele= (Start_encryption_log_event *)
@@ -2931,8 +2937,10 @@ static int send_events(binlog_send_info *info, IO_CACHE* log, LOG_INFO* linfo,
return 1;
}
Log_event_type event_type=
(Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
Log_event_type event_type= static_cast<Log_event_type>(
static_cast<unsigned char>((*packet)[ev_offset + EVENT_TYPE_OFFSET])
);
#ifndef DBUG_OFF
if (info->dbug_reconnect_counter > 0)