| 1 |
# |
| 2 |
# Test ensures that --stop-datetime work correctly for mysqlbinlog. This high |
| 3 |
# level test sets up the binary log (and tags certain locations for comparison), |
| 4 |
# and the helper file binlog_mysqlbinlog_warn_stop_datetime.inc performs the |
| 5 |
# actual tests. |
| 6 |
# |
| 7 |
# References: |
| 8 |
# MDEV-27037: mysqlbinlog emits a warning when reaching EOF before |
| 9 |
# stop-condition |
| 10 |
# MDEV-35528: mariadb-binlog cannot process more than 1 logfiles when |
| 11 |
# --stop-datetime is specified |
| 12 |
# |
| 13 |
--source include/have_log_bin.inc |
| 14 |
|
| 15 |
--let $binlog_out_relpath= tmp/warn_datetime_test_file.out |
| 16 |
--let $binlog_out= $MYSQLTEST_VARDIR/$binlog_out_relpath |
| 17 |
|
| 18 |
--let $b1_timestamp1= 2024-12-01 10:20:30.123456 |
| 19 |
--let $b1_timestamp2= 2024-12-02 10:20:30.123456 |
| 20 |
--let $b1_timestamp3= 2024-12-03 10:20:30.123456 |
| 21 |
--let $b2_timestamp1= 2024-12-04 10:20:30.123456 |
| 22 |
--let $b2_timestamp2= 2024-12-05 10:20:30.123456 |
| 23 |
--let $b2_timestamp3= 2024-12-06 10:20:30.123456 |
| 24 |
--let $b2_timestamp_not_reached= 2024-12-07 10:20:30.123456 |
| 25 |
|
| 26 |
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b1_timestamp1') |
| 27 |
|
| 28 |
--echo # |
| 29 |
--echo # Clear the existing binary log state, and start fresh using |
| 30 |
--echo # the timestamp variable set above |
| 31 |
--echo # |
| 32 |
RESET MASTER; |
| 33 |
|
| 34 |
--let $binlog_f1= query_get_value(SHOW MASTER STATUS, File, 1) |
| 35 |
create table t1 (a int); |
| 36 |
insert into t1 values (1); |
| 37 |
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b1_timestamp2') |
| 38 |
insert into t1 values (2); |
| 39 |
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b1_timestamp3') |
| 40 |
flush binary logs; |
| 41 |
--let $binlog_f2= query_get_value(SHOW MASTER STATUS, File, 1) |
| 42 |
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b2_timestamp1') |
| 43 |
insert into t1 values (3); |
| 44 |
insert into t1 values (4); |
| 45 |
--eval SET TIMESTAMP= UNIX_TIMESTAMP('$b2_timestamp2') |
| 46 |
--let $binlog_f2_gtid_after_midpoint= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 47 |
insert into t1 values (5); |
| 48 |
insert into t1 values (6); |
| 49 |
insert into t1 values (7); |
| 50 |
--let $binlog_f2_last_gtid= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 51 |
--eval SET TIMESTAMP=UNIX_TIMESTAMP('$b2_timestamp3') |
| 52 |
flush binary logs; |
| 53 |
drop table t1; |
| 54 |
|
| 55 |
--echo # Ensuring binary log order is correct |
| 56 |
--let $binlog_f1_show= query_get_value(SHOW BINARY LOGS, Log_name, 1) |
| 57 |
if (`SELECT strcmp('$binlog_f1','$binlog_f1_show') != 0`) |
| 58 |
{ |
| 59 |
--echo # Real binlog_f1: $binlog_f1 |
| 60 |
--echo # First binlog in SHOW BINLOG FILES: $binlog_f1_show |
| 61 |
--die Wrong order of binary log files in SHOW BINARY LOGS |
| 62 |
} |
| 63 |
--let $binlog_f2_show= query_get_value(SHOW BINARY LOGS, Log_name, 2) |
| 64 |
if (`SELECT strcmp('$binlog_f2','$binlog_f2_show') != 0`) |
| 65 |
{ |
| 66 |
--echo # Real binlog_f2: $binlog_f2 |
| 67 |
--echo # First binlog in SHOW BINLOG FILES: $binlog_f2_show |
| 68 |
--die Wrong order of binary log files in SHOW BINARY LOGS |
| 69 |
} |
| 70 |
|
| 71 |
--echo # |
| 72 |
--echo # |
| 73 |
--echo # Test using --read-from-remote-server |
| 74 |
--echo # |
| 75 |
--let $read_from_remote_server= 1 |
| 76 |
--source binlog_mysqlbinlog_warn_stop_datetime.inc |
| 77 |
|
| 78 |
--echo # |
| 79 |
--echo # |
| 80 |
--echo # Test using local binlog files |
| 81 |
--echo # |
| 82 |
--let $read_from_remote_server= 0 |
| 83 |
--source binlog_mysqlbinlog_warn_stop_datetime.inc |
| 84 |
|
| 85 |
--echo # |
| 86 |
--echo # End of binlog_mysqlbinlog_warn_stop_datetime.test |