File: binlog_mysqlbinlog_warn_stop_datetime.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (86 lines) | stat: -rw-r--r-- 3,007 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# 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