mirror of
https://github.com/MariaDB/server.git
synced 2025-09-16 16:42:28 +03:00
This commit adds warnings for `--stop-position` GTIDs that were not reached at EOF, mainly as a follow-up to MDEV-27037 “Mysqlbinlog should output a warning if EOF is found before its stop condition” `--stop-position` warnings inform possible mistakes in the input, especially for progress reporting of scripts/wrappers. MDEV-34614 enhances MDEV-27037 with individualized GTID validation, for GTID range selection weren’t in all versions that MDEV-27037 targeted. The `Gtid_event_filter` family provides the the warning mechanism polymorphically and through the new public method `verify_completed_state`. This design is hierarchically extensible (e.g., to `--ignore-server-ids`). This commit also includes minor touchups: * `rpl_gtid.cc`: adjust cases when a `Window_gtid_event_filter` has only one of `--start-` and `--stop-position` (without intensive refactors) * `rpl_gtid.cc`: function docs improvements * `rpl_gtid.h`: Remove unimplemented, red-herring function prototype `Window_gtid_event_filter::verify_gtid_is_expected` Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
218 lines
11 KiB
Plaintext
218 lines
11 KiB
Plaintext
#
|
|
# Clear the existing binary log state.
|
|
#
|
|
RESET MASTER;
|
|
SET @@SESSION.gtid_domain_id= 0;
|
|
SET @@SESSION.server_id= 1;
|
|
SET @@SESSION.gtid_seq_no= 1;
|
|
create table t1 (a int);
|
|
insert into t1 values (1);
|
|
SET @@SESSION.gtid_domain_id= 1;
|
|
insert into t1 values (2);
|
|
flush binary logs;
|
|
insert into t1 values (3);
|
|
# Tag binlog_f2_mid
|
|
insert into t1 values (4);
|
|
insert into t1 values (5);
|
|
SET @@SESSION.gtid_domain_id= 0;
|
|
insert into t1 values (6);
|
|
insert into t1 values (7);
|
|
flush binary logs;
|
|
drop table t1;
|
|
# Ensuring binary log order is correct
|
|
#
|
|
#
|
|
# Test using --read-from-remote-server
|
|
#
|
|
connection default;
|
|
#
|
|
# --stop-position tests
|
|
#
|
|
# Case 1.a) With one binlog file, a --stop-position before the end of
|
|
# the file should not result in a warning
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f1_pre_rotate binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
#
|
|
# Case 1.b) With one binlog file, a --stop-position at the exact end of
|
|
# the file should not result in a warning
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f1_end binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
#
|
|
# Case 1.c) With one binlog file, a --stop-position past the end of the
|
|
# file should(!) result in a warning
|
|
# MYSQL_BINLOG --read-from-remote-server --short-form --stop-position=binlog_f1_over_eof binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 1-1-2 before end of input
|
|
#
|
|
# Case 2.a) With two binlog files, a --stop-position targeting b2 which
|
|
# exists in the size of b1 should:
|
|
# 1) not provide any warnings
|
|
# 2) not prevent b2 from outputting its desired events before the
|
|
# stop position
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_mid binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
include/assert_grep.inc [Ensure all intended GTIDs are present]
|
|
include/assert_grep.inc [Ensure the next GTID binlogged is _not_ present]
|
|
#
|
|
# Case 2.b) With two binlog files, a --stop-position targeting the end
|
|
# of binlog 2 should:
|
|
# 1) not provide any warnings
|
|
# 2) not prevent b2 from outputting its entire binary log
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_end binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
include/assert_grep.inc [Ensure a GTID exists for each transaction]
|
|
include/assert_grep.inc [Ensure the last GTID binlogged is present]
|
|
#
|
|
# Case 2.c) With two binlog files, a --stop-position targeting beyond
|
|
# the eof of binlog 2 should:
|
|
# 1) provide a warning that the stop position was not reached
|
|
# 2) not prevent b2 from outputting its entire binary log
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_over_eof binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 0-1-5 before end of input
|
|
include/assert_grep.inc [Ensure a GTID exists for each transaction]
|
|
#
|
|
#
|
|
# Test using local binlog files
|
|
#
|
|
connection default;
|
|
#
|
|
# --stop-position tests
|
|
#
|
|
# Case 1.a) With one binlog file, a --stop-position before the end of
|
|
# the file should not result in a warning
|
|
# MYSQL_BINLOG --stop-position=binlog_f1_pre_rotate binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
#
|
|
# Case 1.b) With one binlog file, a --stop-position at the exact end of
|
|
# the file should not result in a warning
|
|
# MYSQL_BINLOG --stop-position=binlog_f1_end binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
#
|
|
# Case 1.c) With one binlog file, a --stop-position past the end of the
|
|
# file should(!) result in a warning
|
|
# MYSQL_BINLOG --short-form --stop-position=binlog_f1_over_eof binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 1-1-2 before end of input
|
|
#
|
|
# Case 2.a) With two binlog files, a --stop-position targeting b2 which
|
|
# exists in the size of b1 should:
|
|
# 1) not provide any warnings
|
|
# 2) not prevent b2 from outputting its desired events before the
|
|
# stop position
|
|
# MYSQL_BINLOG --stop-position=binlog_f2_mid binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
include/assert_grep.inc [Ensure all intended GTIDs are present]
|
|
include/assert_grep.inc [Ensure the next GTID binlogged is _not_ present]
|
|
#
|
|
# Case 2.b) With two binlog files, a --stop-position targeting the end
|
|
# of binlog 2 should:
|
|
# 1) not provide any warnings
|
|
# 2) not prevent b2 from outputting its entire binary log
|
|
# MYSQL_BINLOG --stop-position=binlog_f2_end binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
include/assert_grep.inc [Ensure a GTID exists for each transaction]
|
|
include/assert_grep.inc [Ensure the last GTID binlogged is present]
|
|
#
|
|
# Case 2.c) With two binlog files, a --stop-position targeting beyond
|
|
# the eof of binlog 2 should:
|
|
# 1) provide a warning that the stop position was not reached
|
|
# 2) not prevent b2 from outputting its entire binary log
|
|
# MYSQL_BINLOG --stop-position=binlog_f2_over_eof binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 0-1-5 before end of input
|
|
include/assert_grep.inc [Ensure a GTID exists for each transaction]
|
|
# Poison GTID lists with an extraneous GTID domain - expect additional `9-1-1` warnings
|
|
#
|
|
#
|
|
# Test extraneous stop GTID using --read-from-remote-server
|
|
#
|
|
connection default;
|
|
#
|
|
# --stop-position tests
|
|
#
|
|
# Case 1.a) With one binlog file, a --stop-position before the end of
|
|
# the file should not result in a warning
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f1_pre_rotate binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
#
|
|
# Case 1.b) With one binlog file, a --stop-position at the exact end of
|
|
# the file should not result in a warning
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f1_end binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
#
|
|
# Case 1.c) With one binlog file, a --stop-position past the end of the
|
|
# file should(!) result in a warning
|
|
# MYSQL_BINLOG --read-from-remote-server --short-form --stop-position=binlog_f1_over_eof binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 1-1-2 before end of input
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
#
|
|
# Case 2.a) With two binlog files, a --stop-position targeting b2 which
|
|
# exists in the size of b1 should:
|
|
# 1) not provide any warnings
|
|
# 2) not prevent b2 from outputting its desired events before the
|
|
# stop position
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_mid binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
include/assert_grep.inc [Ensure all intended GTIDs are present]
|
|
include/assert_grep.inc [Ensure the next GTID binlogged is _not_ present]
|
|
#
|
|
# Case 2.b) With two binlog files, a --stop-position targeting the end
|
|
# of binlog 2 should:
|
|
# 1) not provide any warnings
|
|
# 2) not prevent b2 from outputting its entire binary log
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_end binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
include/assert_grep.inc [Ensure a GTID exists for each transaction]
|
|
include/assert_grep.inc [Ensure the last GTID binlogged is present]
|
|
#
|
|
# Case 2.c) With two binlog files, a --stop-position targeting beyond
|
|
# the eof of binlog 2 should:
|
|
# 1) provide a warning that the stop position was not reached
|
|
# 2) not prevent b2 from outputting its entire binary log
|
|
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_over_eof binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 0-1-5 before end of input
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
include/assert_grep.inc [Ensure a GTID exists for each transaction]
|
|
#
|
|
#
|
|
# Test extraneous stop GTID using local binlog files
|
|
#
|
|
connection default;
|
|
#
|
|
# --stop-position tests
|
|
#
|
|
# Case 1.a) With one binlog file, a --stop-position before the end of
|
|
# the file should not result in a warning
|
|
# MYSQL_BINLOG --stop-position=binlog_f1_pre_rotate binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
#
|
|
# Case 1.b) With one binlog file, a --stop-position at the exact end of
|
|
# the file should not result in a warning
|
|
# MYSQL_BINLOG --stop-position=binlog_f1_end binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
#
|
|
# Case 1.c) With one binlog file, a --stop-position past the end of the
|
|
# file should(!) result in a warning
|
|
# MYSQL_BINLOG --short-form --stop-position=binlog_f1_over_eof binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 1-1-2 before end of input
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
#
|
|
# Case 2.a) With two binlog files, a --stop-position targeting b2 which
|
|
# exists in the size of b1 should:
|
|
# 1) not provide any warnings
|
|
# 2) not prevent b2 from outputting its desired events before the
|
|
# stop position
|
|
# MYSQL_BINLOG --stop-position=binlog_f2_mid binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
include/assert_grep.inc [Ensure all intended GTIDs are present]
|
|
include/assert_grep.inc [Ensure the next GTID binlogged is _not_ present]
|
|
#
|
|
# Case 2.b) With two binlog files, a --stop-position targeting the end
|
|
# of binlog 2 should:
|
|
# 1) not provide any warnings
|
|
# 2) not prevent b2 from outputting its entire binary log
|
|
# MYSQL_BINLOG --stop-position=binlog_f2_end binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
include/assert_grep.inc [Ensure a GTID exists for each transaction]
|
|
include/assert_grep.inc [Ensure the last GTID binlogged is present]
|
|
#
|
|
# Case 2.c) With two binlog files, a --stop-position targeting beyond
|
|
# the eof of binlog 2 should:
|
|
# 1) provide a warning that the stop position was not reached
|
|
# 2) not prevent b2 from outputting its entire binary log
|
|
# MYSQL_BINLOG --stop-position=binlog_f2_over_eof binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
|
|
WARNING: Did not reach stop position 0-1-5 before end of input
|
|
WARNING: Did not reach stop position 9-1-1 before end of input
|
|
include/assert_grep.inc [Ensure a GTID exists for each transaction]
|
|
#
|
|
# End of binlog_mysqlbinlog_warn_stop_gtid.test
|