From 2f6bb9cda57e2ddbfffc5bdad00dfb352dab1313 Mon Sep 17 00:00:00 2001 From: Anel Husakovic Date: Mon, 20 Feb 2023 14:11:13 +0100 Subject: [PATCH] MDEV-30698 Cover missing test cases for mariadb-binlog options --raw [and] --flashback - Adding test case for --raw without -R - Adding unsuported combination of --raw and --flashback parameters and covered with test case --- client/mysqlbinlog.cc | 6 ++++++ .../suite/binlog/r/binlog_mysqlbinlog_raw_flush.result | 4 ++++ mysql-test/suite/binlog/r/flashback.result | 4 ++++ .../suite/binlog/t/binlog_mysqlbinlog_raw_flush.test | 9 +++++++++ mysql-test/suite/binlog/t/flashback.test | 8 ++++++++ 5 files changed, 31 insertions(+) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 8770b3651cc..ec0cae5328c 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -3063,6 +3063,12 @@ int main(int argc, char** argv) my_set_max_open_files(open_files_limit); + if (opt_flashback && opt_raw_mode) + { + error("The --raw mode is not allowed with --flashback mode"); + die(1); + } + if (opt_flashback) { my_init_dynamic_array(&binlog_events, sizeof(LEX_STRING), 1024, 1024, diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result index 9148f0e8c2b..294e96e5997 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result @@ -1,3 +1,7 @@ +# +# MDEV-30698 Cover missing test cases for mariadb-binlog options +# --raw [and] --flashback +# CREATE TABLE t1 (a int); FLUSH LOGS; INSERT INTO t1 VALUES (1); diff --git a/mysql-test/suite/binlog/r/flashback.result b/mysql-test/suite/binlog/r/flashback.result index eaced02b7a9..12e47363fe2 100644 --- a/mysql-test/suite/binlog/r/flashback.result +++ b/mysql-test/suite/binlog/r/flashback.result @@ -702,6 +702,10 @@ include/assert.inc [Table t1 should have 0 rows.] # 6- Rows must be present upon restoring from flashback include/assert.inc [Table t1 should have six rows.] DROP TABLE t1; +# +# MDEV-30698 Cover missing test cases for mariadb-binlog options +# --raw [and] --flashback +# SET binlog_format=statement; Warnings: Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test index f95fc0137a2..252a8577b6c 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test @@ -5,6 +5,7 @@ # respective log file specified by --result-file, and shown on-disk. This test # ensures that the log files on disk, created by mariadb-binlog, have the most # up-to-date events from the master. +# Option --raw works only with --read-from-remote-server, otherwise returns error. # # Methodology: # On the master, rotate to a newly active binlog file and write an event to @@ -20,6 +21,14 @@ --source include/linux.inc --source include/have_log_bin.inc +--echo # +--echo # MDEV-30698 Cover missing test cases for mariadb-binlog options +--echo # --raw [and] --flashback +--echo # +# Test --raw format without -R (--read-from-remote-server) +--error 1 # Error 1 operation not permitted +--exec $MYSQL_BINLOG --raw --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --stop-never --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001 + # Create newly active log CREATE TABLE t1 (a int); FLUSH LOGS; diff --git a/mysql-test/suite/binlog/t/flashback.test b/mysql-test/suite/binlog/t/flashback.test index abe054e4de0..50190da6dbe 100644 --- a/mysql-test/suite/binlog/t/flashback.test +++ b/mysql-test/suite/binlog/t/flashback.test @@ -364,6 +364,14 @@ FLUSH LOGS; DROP TABLE t1; +--echo # +--echo # MDEV-30698 Cover missing test cases for mariadb-binlog options +--echo # --raw [and] --flashback +--echo # + +--error 1 # --raw mode and --flashback mode are not allowed +--exec $MYSQL_BINLOG -vv -B --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000003> $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_8.sql + ## Clear SET binlog_format=statement; --error ER_FLASHBACK_NOT_SUPPORTED