1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

cleanup: Log_event::read_log_event()

There are three Log_event::read_log_event() methods:
1. read the event image from IO_CACHE into String
2. create Log_event from the in-memory event image
3. read the event image from IO_CACHE and create Log_event

The 3rd was reading event image into memory and invoking the 2nd to
create Log_event. Now the 3rd also uses the 1st to read the event image
from IO_CACHE into memory, instead of duplicating its functionality.
This commit is contained in:
Sergei Golubchik
2015-08-17 18:38:30 +02:00
parent 08687f7ef3
commit 5018a6606f
5 changed files with 140 additions and 204 deletions

View File

@ -1436,8 +1436,9 @@ gtid_state_from_pos(const char *name, uint32 offset,
break;
packet.length(0);
err= Log_event::read_log_event(&cache, &packet, NULL,
current_checksum_alg);
err= Log_event::read_log_event(&cache, &packet,
opt_master_verify_checksum
? current_checksum_alg : 0);
if (err)
{
errormsg= "Could not read binlog while searching for slave start "
@ -2230,8 +2231,9 @@ static int send_format_descriptor_event(binlog_send_info *info,
the binlog
*/
info->last_pos= my_b_tell(log);
error= Log_event::read_log_event(log, packet, /* LOCK_log */ NULL,
info->current_checksum_alg);
error= Log_event::read_log_event(log, packet,
opt_master_verify_checksum
? info->current_checksum_alg : 0);
linfo->pos= my_b_tell(log);
if (error)
@ -2566,9 +2568,9 @@ static int send_events(binlog_send_info *info,
return 1;
info->last_pos= linfo->pos;
error = Log_event::read_log_event(log, packet, /* LOCK_log */ NULL,
info->current_checksum_alg,
NULL, NULL);
error= Log_event::read_log_event(log, packet,
opt_master_verify_checksum
? info->current_checksum_alg : 0);
linfo->pos= my_b_tell(log);
if (error)