mariadb/mysql-test/suite/rpl
Brandon Nesterenko 0f5e5ced37 MDEV-37662: Binlog Corruption When tmpdir is Full
The binary log could be corrupted when committing a large transaction
(i.e. one whose data exceeds the binlog_cache_size limit and spills
into a tmp file) in binlog_format=row if the server's --tmp-dir is
full. The corruption that happens is only the GTID of the errored
transaction would be written into the binary log, without any
body/finalizing events.  This would happen because the content of the
transaction wasn't flushed at the proper time, and the transaction's
binlog cache data was not durable while trying to copy the content
from the binlog cache file into the binary log itself. While switching
the tmp file from a WRITE_CACHE to a READ_CACHE, the server would see
there is still data to flush in the cache, and first try to flush it.
This is not a valid time to flush that data to the temporary file
though, as:

  1. The GTID event has already been written directly to the binary
     log. So if this flushing fails, it leaves the binary log in a
     corrupted state.

  2. This is done during group commit, and will slow down other
     concurrent transactions, which are otherwise ready to commit.

This patch fixes these issues by ensuring all transaction data is
fully flushed to its temporary file (if used) before starting any
critical paths, i.e. in binlog_flush_cache(). Note that if the binlog
cache is solely in-memory, this flush-to-temporary-file is skipped.

Reviewed-by: Andrei Elkin <andrei.elkin@mariadb.com>
Signed-off-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
2025-11-19 07:05:49 -07:00
..
extension mtr: use env for perl 2020-06-23 03:24:46 +02:00
include Merge 10.6 -> 10.11 2024-12-05 10:11:58 +01:00
r MDEV-37662: Binlog Corruption When tmpdir is Full 2025-11-19 07:05:49 -07:00
t MDEV-37662: Binlog Corruption When tmpdir is Full 2025-11-19 07:05:49 -07:00
disabled.def Fix RPL tests post DEBUG_SYNC change 2023-02-10 14:44:45 +02:00
my.cnf Remove duplicated default client include from replication my.cnf 2023-09-14 12:56:41 +02:00
README
rpl_1slave_base.cnf

How to run.
===========

./mysql-test-run.pl --suite=rpl --mysqld=--binlog-format=mixed