| 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-34614 mysqlbinlog warn on EOF before GTID in --stop-position |
| 9 |
# |
| 10 |
--source include/have_log_bin.inc |
| 11 |
|
| 12 |
--let $binlog_out_relpath= tmp/warn_position_test_file.out |
| 13 |
--let $binlog_out= $MYSQLTEST_VARDIR/$binlog_out_relpath |
| 14 |
|
| 15 |
--echo # |
| 16 |
--echo # Clear the existing binary log state. |
| 17 |
--echo # |
| 18 |
RESET MASTER; |
| 19 |
|
| 20 |
SET @@SESSION.gtid_domain_id= 0; |
| 21 |
SET @@SESSION.server_id= 1; |
| 22 |
--let $binlog_f1= query_get_value(SHOW MASTER STATUS, File, 1) |
| 23 |
SET @@SESSION.gtid_seq_no= 1; |
| 24 |
create table t1 (a int); |
| 25 |
insert into t1 values (1); |
| 26 |
SET @@SESSION.gtid_domain_id= 1; |
| 27 |
insert into t1 values (2); |
| 28 |
--let $binlog_f1_pre_rotate= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 29 |
flush binary logs; |
| 30 |
--let $binlog_f1_end= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 31 |
|
| 32 |
--let $binlog_f2= query_get_value(SHOW MASTER STATUS, File, 1) |
| 33 |
insert into t1 values (3); |
| 34 |
--echo # Tag binlog_f2_mid |
| 35 |
--let $binlog_f2_mid= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 36 |
--let $binlog_f1_over_eof= $binlog_f2_mid |
| 37 |
insert into t1 values (4); |
| 38 |
--let $binlog_f2_gtid_after_midpoint= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 39 |
insert into t1 values (5); |
| 40 |
SET @@SESSION.gtid_domain_id= 0; |
| 41 |
insert into t1 values (6); |
| 42 |
insert into t1 values (7); |
| 43 |
--let $binlog_f2_last_gtid= `SELECT REGEXP_SUBSTR(@@GLOBAL.gtid_binlog_pos, '0-1-\\\\\\\\d++')` |
| 44 |
flush binary logs; |
| 45 |
--let $binlog_f2_end= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 46 |
drop table t1; |
| 47 |
--let $binlog_f2_over_eof= `SELECT @@GLOBAL.gtid_binlog_pos` |
| 48 |
|
| 49 |
--echo # Ensuring binary log order is correct |
| 50 |
--let $binlog_f1_show= query_get_value(SHOW BINARY LOGS, Log_name, 1) |
| 51 |
if (`SELECT strcmp('$binlog_f1','$binlog_f1_show') != 0`) |
| 52 |
{ |
| 53 |
--echo # Real binlog_f1: $binlog_f1 |
| 54 |
--echo # First binlog in SHOW BINLOG FILES: $binlog_f1_show |
| 55 |
--die Wrong order of binary log files in SHOW BINARY LOGS |
| 56 |
} |
| 57 |
--let $binlog_f2_show= query_get_value(SHOW BINARY LOGS, Log_name, 2) |
| 58 |
if (`SELECT strcmp('$binlog_f2','$binlog_f2_show') != 0`) |
| 59 |
{ |
| 60 |
--echo # Real binlog_f2: $binlog_f2 |
| 61 |
--echo # First binlog in SHOW BINLOG FILES: $binlog_f2_show |
| 62 |
--die Wrong order of binary log files in SHOW BINARY LOGS |
| 63 |
} |
| 64 |
|
| 65 |
--let $domain_id= [01] |
| 66 |
|
| 67 |
--echo # |
| 68 |
--echo # |
| 69 |
--echo # Test using --read-from-remote-server |
| 70 |
--echo # |
| 71 |
--let $read_from_remote_server= 1 |
| 72 |
--source binlog_mysqlbinlog_warn_stop_position.inc |
| 73 |
|
| 74 |
--echo # |
| 75 |
--echo # |
| 76 |
--echo # Test using local binlog files |
| 77 |
--echo # |
| 78 |
--let $read_from_remote_server= 0 |
| 79 |
--source binlog_mysqlbinlog_warn_stop_position.inc |
| 80 |
|
| 81 |
--echo # Poison GTID lists with an extraneous GTID domain - expect additional `9-1-1` warnings |
| 82 |
--let $binlog_f1_pre_rotate= 9-1-1 |
| 83 |
--let $binlog_f2_mid= $binlog_f1_pre_rotate,$binlog_f2_mid |
| 84 |
--let $binlog_f1_end= $binlog_f1_pre_rotate,$binlog_f1_end |
| 85 |
--let $binlog_f2_end= $binlog_f1_pre_rotate,$binlog_f2_end |
| 86 |
--let $binlog_f1_over_eof= $binlog_f1_pre_rotate,$binlog_f1_over_eof |
| 87 |
--let $binlog_f2_over_eof= $binlog_f1_pre_rotate,$binlog_f2_over_eof |
| 88 |
--echo # |
| 89 |
--echo # |
| 90 |
--echo # Test extraneous stop GTID using --read-from-remote-server |
| 91 |
--echo # |
| 92 |
--let $read_from_remote_server= 1 |
| 93 |
--source binlog_mysqlbinlog_warn_stop_position.inc |
| 94 |
|
| 95 |
--echo # |
| 96 |
--echo # |
| 97 |
--echo # Test extraneous stop GTID using local binlog files |
| 98 |
--echo # |
| 99 |
--let $read_from_remote_server= 0 |
| 100 |
--source binlog_mysqlbinlog_warn_stop_position.inc |
| 101 |
|
| 102 |
--echo # |
| 103 |
--echo # End of binlog_mysqlbinlog_warn_stop_gtid.test |