← Back to team overview

maria-developers team mailing list archive

Re: d9913834ceb: MDEV-14014 Multi-Slave Replication Fail: bogus data in log event

 

Hi, andrei.elkin!

On May 30, andrei.elkin@xxxxxxxxxx wrote:
> revision-id: d9913834cebe4ed8494b3d76762cd882788a8fd5 (mariadb-10.1.33-28-gd9913834ceb)
> parent(s): c1698e8dc50f0c342c1a6886426ba1d43396cd1e
> author: Andrei Elkin
> committer: Andrei Elkin
> timestamp: 2018-05-30 20:06:44 +0300
> message:
> 
> MDEV-14014 Multi-Slave Replication Fail: bogus data in log event
> 
> MDEV-7257 made a dump thread to read from binlog concurrently with
> writers as long as the read bytes are below a water-mark
> (MYSQL_BIN_LOG::binlog_end_pos). However it appeared to be possible a
> dump thread reader reach out for bytes past the water mark through a
> feature of IO_CACHE that fills in the internal buffer and while doing
> so it could read what the reader is not supposed to see (the bytes
> above MYSQL_BIN_LOG::binlog_end_pos).
> 
> The issue is fixed with constraining the IO_CACHE buffer fill to respect
> the watermark.
> An added test simulates potentially unconstrained buffer fill and an
> assert guards this is not the case anymore.

What about a much simpler one-liner fix:

--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -2549,6 +2549,7 @@ static int send_events(binlog_send_info *info, IO_CACHE*
       return 1;

     info->last_pos= linfo->pos;
+    log->end_of_file= end_pos;
     error= Log_event::read_log_event(log, packet, info->fdev,
                        opt_master_verify_checksum ? info->current_checksum_alg
                                                   : BINLOG_CHECKSUM_ALG_OFF);

It doesn't change IO_CACHE structure and doesn't add any
overhead to the IO_CACHE.

Did you already test that your commit actually fixes the issue?

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx


Follow ups