| 1 |
# |
| 2 |
# Test ensures that --stop-position 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_position.inc performs the |
| 5 |
# actual tests. |
| 6 |
# |
| 7 |
# References: |
| 8 |
# MDEV-27037: mysqlbinlog emits a warning when reaching EOF before |
| 9 |
# stop-condition |
| 10 |
# |
| 11 |
--source include/have_log_bin.inc |
| 12 |
|
| 13 |
--let $binlog_out_relpath= tmp/warn_position_test_file.out |
| 14 |
--let $binlog_out= $MYSQLTEST_VARDIR/$binlog_out_relpath |
| 15 |
|
| 16 |
--echo # |
| 17 |
--echo # Clear the existing binary log state. |
| 18 |
--echo # |
| 19 |
RESET MASTER; |
| 20 |
|
| 21 |
--let $binlog_f1= query_get_value(SHOW MASTER STATUS, File, 1) |
| 22 |
create table t1 (a int); |
| 23 |
insert into t1 values (1); |
| 24 |
insert into t1 values (2); |
| 25 |
--let $binlog_f1_pre_rotate= query_get_value(SHOW MASTER STATUS, Position, 1) |
| 26 |
flush binary logs; |
| 27 |
--let $binlog_f2= query_get_value(SHOW MASTER STATUS, File, 1) |
| 28 |
insert into t1 values (3); |
| 29 |
--echo # Tag binlog_f2_mid |
| 30 |
--let $binlog_f2_mid= query_get_value(SHOW MASTER STATUS, Position, 1) |
| 31 |
insert into t1 values (4); |
| 32 |
--let $binlog_f2_gtid_after_midpoint= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 33 |
insert into t1 values (5); |
| 34 |
insert into t1 values (6); |
| 35 |
insert into t1 values (7); |
| 36 |
--let $binlog_f2_last_gtid= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 37 |
--let $binlog_f2_pre_rot= query_get_value(SHOW MASTER STATUS, Position, 1) |
| 38 |
flush binary logs; |
| 39 |
drop table t1; |
| 40 |
|
| 41 |
--echo # Ensuring binary log order is correct |
| 42 |
--let $binlog_f1_show= query_get_value(SHOW BINARY LOGS, Log_name, 1) |
| 43 |
--let $binlog_f1_end= query_get_value(SHOW BINARY LOGS, File_size, 1) |
| 44 |
if (`SELECT strcmp('$binlog_f1','$binlog_f1_show') != 0`) |
| 45 |
{ |
| 46 |
--echo # Real binlog_f1: $binlog_f1 |
| 47 |
--echo # First binlog in SHOW BINLOG FILES: $binlog_f1_show |
| 48 |
--die Wrong order of binary log files in SHOW BINARY LOGS |
| 49 |
} |
| 50 |
--let $binlog_f2_show= query_get_value(SHOW BINARY LOGS, Log_name, 2) |
| 51 |
--let $binlog_f2_end= query_get_value(SHOW BINARY LOGS, File_size, 2) |
| 52 |
if (`SELECT strcmp('$binlog_f2','$binlog_f2_show') != 0`) |
| 53 |
{ |
| 54 |
--echo # Real binlog_f2: $binlog_f2 |
| 55 |
--echo # First binlog in SHOW BINLOG FILES: $binlog_f2_show |
| 56 |
--die Wrong order of binary log files in SHOW BINARY LOGS |
| 57 |
} |
| 58 |
|
| 59 |
--echo # Ensuring file offset of binlog_f2_mid < binlog_f1_end |
| 60 |
if ($binlog_f2_mid > $binlog_f1_end) |
| 61 |
{ |
| 62 |
--echo # Binlog 1 end: $binlog_f1:$binlog_f1_end |
| 63 |
--echo # Binlog 2 stop point: $binlog_f2:$binlog_f2_mid |
| 64 |
--die Mid point chosen to end in binlog 2 does not exist in earlier binlog |
| 65 |
} |
| 66 |
|
| 67 |
--let $domain_id= `SELECT @@GLOBAL.gtid_domain_id` |
| 68 |
--let $binlog_f1_over_eof= `SELECT $binlog_f1_end + 1` |
| 69 |
--let $binlog_f2_over_eof= `SELECT $binlog_f2_end + 1` |
| 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_position.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_position.inc |
| 84 |
|
| 85 |
--echo # |
| 86 |
--echo # End of binlog_mysqlbinlog_warn_stop_position.test |