1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00
Files
mariadb/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_position.test
Brandon Nesterenko 588f7a5af7 MDEV-35694: Mysqlbinlog --stop-position should warn if EOF not reached with --read-from-remote-server
MDEV-27037 added functionality to warn users that a specified
stop-position or stop-datetime was never reached. It only worked for
local files though. The patch in MDEV-35528 changed the
implementation for stop-datetime to work to provide the warning also
when using --read-from-remote-server. The PR for that MDEV (#3670)
was limited to only the stop-datetime field.

This patch updates the --stop-position warning to also work with
--read-from-remote-server.

Reviewed By:
============
Andrei Elkin <andrei.elkin@mariadb.com>
Jimmy Hu <jimmy.hu@mariadb.com>
2025-04-21 14:21:55 -06:00

83 lines
2.8 KiB
Plaintext

#
# Test ensures that --stop-position work correctly for mysqlbinlog. This high
# level test sets up the binary log (and tags certain locations for comparison),
# and the helper file binlog_mysqlbinlog_warn_stop_position.inc performs the
# actual tests.
#
# References:
# MDEV-27037: mysqlbinlog emits a warning when reaching EOF before
# stop-condition
#
--source include/have_log_bin.inc
--let $binlog_out_relpath= tmp/warn_position_test_file.out
--let $binlog_out= $MYSQLTEST_VARDIR/$binlog_out_relpath
--echo #
--echo # Clear the existing binary log state.
--echo #
RESET MASTER;
--let $binlog_f1= query_get_value(SHOW MASTER STATUS, File, 1)
create table t1 (a int);
insert into t1 values (1);
insert into t1 values (2);
--let $binlog_f1_pre_rotate= query_get_value(SHOW MASTER STATUS, Position, 1)
flush binary logs;
--let $binlog_f2= query_get_value(SHOW MASTER STATUS, File, 1)
insert into t1 values (3);
--echo # Tag binlog_f2_mid
--let $binlog_f2_mid= query_get_value(SHOW MASTER STATUS, Position, 1)
insert into t1 values (4);
--let $binlog_f2_gtid_after_midpoint= `SELECT @@GLOBAL.gtid_binlog_pos`
insert into t1 values (5);
insert into t1 values (6);
insert into t1 values (7);
--let $binlog_f2_last_gtid= `SELECT @@GLOBAL.gtid_binlog_pos`
--let $binlog_f2_pre_rot= query_get_value(SHOW MASTER STATUS, Position, 1)
flush binary logs;
drop table t1;
--echo # Ensuring binary log order is correct
--let $binlog_f1_show= query_get_value(SHOW BINARY LOGS, Log_name, 1)
--let $binlog_f1_end= query_get_value(SHOW BINARY LOGS, File_size, 1)
if (`SELECT strcmp('$binlog_f1','$binlog_f1_show') != 0`)
{
--echo # Real binlog_f1: $binlog_f1
--echo # First binlog in SHOW BINLOG FILES: $binlog_f1_show
--die Wrong order of binary log files in SHOW BINARY LOGS
}
--let $binlog_f2_show= query_get_value(SHOW BINARY LOGS, Log_name, 2)
--let $binlog_f2_end= query_get_value(SHOW BINARY LOGS, File_size, 2)
if (`SELECT strcmp('$binlog_f2','$binlog_f2_show') != 0`)
{
--echo # Real binlog_f2: $binlog_f2
--echo # First binlog in SHOW BINLOG FILES: $binlog_f2_show
--die Wrong order of binary log files in SHOW BINARY LOGS
}
--echo # Ensuring file offset of binlog_f2_mid < binlog_f1_end
if ($binlog_f2_mid > $binlog_f1_end)
{
--echo # Binlog 1 end: $binlog_f1:$binlog_f1_end
--echo # Binlog 2 stop point: $binlog_f2:$binlog_f2_mid
--die Mid point chosen to end in binlog 2 does not exist in earlier binlog
}
--echo #
--echo #
--echo # Test using --read-from-remote-server
--echo #
--let $read_from_remote_server= 1
--source binlog_mysqlbinlog_warn_stop_position.inc
--echo #
--echo #
--echo # Test using local binlog files
--echo #
--let $read_from_remote_server= 0
--source binlog_mysqlbinlog_warn_stop_position.inc
--echo #
--echo # End of binlog_mysqlbinlog_warn_stop_position.test