mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Fix regression introduced by commits 9588526
which attempted to address
MDEV-27037. With the regression, mariadb-binlog cannot process multiple
log files when --stop-datetime is specified.
The change is to keep recording timestamp of last processed event, and
after all log files are processed, if the last recorded timestamp has not
reached specified --stop-datetime, it will emit a warning. This applies
when processing local log files, or log files from remote servers.
All new code of the whole pull request, including one or several files that are
either new files or modified ones, are contributed under the BSD-new license. I
am contributing on behalf of my employer Amazon Web Services, Inc.
Co-authored-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
87 lines
2.9 KiB
Plaintext
87 lines
2.9 KiB
Plaintext
#
|
|
# Test ensures that --stop-datetime 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_datetime.inc performs the
|
|
# actual tests.
|
|
#
|
|
# References:
|
|
# MDEV-27037: mysqlbinlog emits a warning when reaching EOF before
|
|
# stop-condition
|
|
# MDEV-35528: mariadb-binlog cannot process more than 1 logfiles when
|
|
# --stop-datetime is specified
|
|
#
|
|
--source include/have_log_bin.inc
|
|
|
|
--let $binlog_out_relpath= tmp/warn_datetime_test_file.out
|
|
--let $binlog_out= $MYSQLTEST_VARDIR/$binlog_out_relpath
|
|
|
|
--let $b1_timestamp1= 2024-12-01 10:20:30.123456
|
|
--let $b1_timestamp2= 2024-12-02 10:20:30.123456
|
|
--let $b1_timestamp3= 2024-12-03 10:20:30.123456
|
|
--let $b2_timestamp1= 2024-12-04 10:20:30.123456
|
|
--let $b2_timestamp2= 2024-12-05 10:20:30.123456
|
|
--let $b2_timestamp3= 2024-12-06 10:20:30.123456
|
|
--let $b2_timestamp_not_reached= 2024-12-07 10:20:30.123456
|
|
|
|
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b1_timestamp1')
|
|
|
|
--echo #
|
|
--echo # Clear the existing binary log state, and start fresh using
|
|
--echo # the timestamp variable set above
|
|
--echo #
|
|
RESET MASTER;
|
|
|
|
--let $binlog_f1= query_get_value(SHOW MASTER STATUS, File, 1)
|
|
create table t1 (a int);
|
|
insert into t1 values (1);
|
|
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b1_timestamp2')
|
|
insert into t1 values (2);
|
|
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b1_timestamp3')
|
|
flush binary logs;
|
|
--let $binlog_f2= query_get_value(SHOW MASTER STATUS, File, 1)
|
|
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b2_timestamp1')
|
|
insert into t1 values (3);
|
|
insert into t1 values (4);
|
|
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b2_timestamp2')
|
|
--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`
|
|
--eval SET TIMESTAMP=UNIX_TIMESTAMP('$b2_timestamp3')
|
|
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)
|
|
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)
|
|
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 #
|
|
--echo #
|
|
--echo # Test using --read-from-remote-server
|
|
--echo #
|
|
--let $read_from_remote_server= 1
|
|
--source binlog_mysqlbinlog_warn_stop_datetime.inc
|
|
|
|
--echo #
|
|
--echo #
|
|
--echo # Test using local binlog files
|
|
--echo #
|
|
--let $read_from_remote_server= 0
|
|
--source binlog_mysqlbinlog_warn_stop_datetime.inc
|
|
|
|
--echo #
|
|
--echo # End of binlog_mysqlbinlog_warn_stop_datetime.test
|