diff options
author | Brandon Nesterenko <brandon.nesterenko@mariadb.com> | 2021-09-03 10:39:52 -0600 |
---|---|---|
committer | Brandon Nesterenko <brandon.nesterenko@mariadb.com> | 2021-09-03 10:40:28 -0600 |
commit | e2f54ead5e01740e7971c017cf66483388ea6198 (patch) | |
tree | 13e2185b3dbe6dd3cf7d3aad1a30a09495d86c01 | |
parent | f55477060c008dfef1f27768d5ce45d87f26af34 (diff) | |
download | mariadb-git-bb-10.2-MDEV-23746.tar.gz |
MDEV-23746: Warnings about memory lost after using --flashback server option with binlog_row_image=minimalbb-10.2-MDEV-23746
Problem:
========
Where the combination of --flashback with binlog_row_image=’MINIMAL’
is invalid, and mariadb-binlog will exit early with error if reading
a binary log written to in MINIMAL binlog_row_image using
--flashback, memory leak errors are inappropriately printed as well.
Solution:
========
Suppress the memory leak errors upon the early termination of
mariadb-binlog.
Reviewed By:
============
<TODO>
3 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_flashback_minimal_row_image.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_flashback_minimal_row_image.result new file mode 100644 index 00000000000..f5f0307bcab --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_flashback_minimal_row_image.result @@ -0,0 +1,8 @@ +set binlog_row_image="minimal"; +create table t1 (a int primary key, b int) engine=innodb; +insert into t1 values (1,1), (2,2), (3,3); +reset master; +replace into t1 values (3,5); +flush logs; +MYSQL_BINLOG -B MYSQLD_DATADIR/master-bin.000001 > MYSQLTEST_VARDIR/tmp/f1.sql +drop table t1; diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_flashback_minimal_row_image.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_flashback_minimal_row_image.test new file mode 100644 index 00000000000..74bcb90fdd8 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_flashback_minimal_row_image.test @@ -0,0 +1,29 @@ +# +# Purpose: +# This test ensures that memory leak errors do no print when mariadb-binlog is +# incorrectly invoked with flashback on for a log written to with MINIMAL used +# for binlog_row_image. +# +# References: +# MDEV-23746: Warnings about memory lost after using --flashback server option +# with binlog_row_image="minimal" +# + +--source include/have_binlog_format_row.inc +--source include/have_innodb.inc + +set binlog_row_image="minimal"; + +create table t1 (a int primary key, b int) engine=innodb; +insert into t1 values (1,1), (2,2), (3,3); + +reset master; +replace into t1 values (3,5); +flush logs; + +let $MYSQLD_DATADIR= `select @@datadir`; +--echo MYSQL_BINLOG -B MYSQLD_DATADIR/master-bin.000001 > MYSQLTEST_VARDIR/tmp/f1.sql +--error 1 +--exec $MYSQL_BINLOG -B $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/f1.sql + +drop table t1; diff --git a/sql/log_event.cc b/sql/log_event.cc index 04577be4f6f..01986776f38 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3213,6 +3213,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf (const uchar*) "", TRUE))) { fprintf(stderr, "\nError row length: %zu\n", length1); + sf_leaking_memory= 1; exit(1); } value+= length1; @@ -3222,6 +3223,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf { fprintf(stderr, "\nError: Out of memory. " "Could not exchange to flashback event.\n"); + sf_leaking_memory= 1; exit(1); } memcpy(swap_buff1, start_pos, length1); @@ -3236,6 +3238,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf (const uchar*) "", TRUE))) { fprintf(stderr, "\nError row length: %zu\n", length2); + sf_leaking_memory= 1; exit(1); } value+= length2; @@ -3245,6 +3248,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf { fprintf(stderr, "\nError: Out of memory. " "Could not exchange to flashback event.\n"); + sf_leaking_memory= 1; exit(1); } memcpy(swap_buff2, start_pos + length1, length2); // WHERE part @@ -3267,6 +3271,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf { fprintf(stderr, "\nError: Out of memory. " "Could not push flashback event into array.\n"); + sf_leaking_memory= 1; exit(1); } } |