-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-34614 mysqlbinlog warn on EOF before GTID in --stop-position
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 (#3400). `--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`. It’s uncommon to commit a new public API targeting a non-latest version, but this design is not only hierarchical but also extensible (e.g., to `--ignore-server-ids`).
- Loading branch information
Showing
5 changed files
with
189 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_gtid.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
# MDEV-34614 mysqlbinlog warn on EOF before GTID in --stop-position | ||
|
||
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), (2); | ||
SET @@session.gtid_domain_id= 1; | ||
CREATE TABLE t2(a int); | ||
INSERT INTO t2 VALUES (3); | ||
FLUSH LOGS; | ||
Case: Default, must not see warning. | ||
# MYSQL_BINLOG --short-form MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
Case: Stop GTID at EOF, must not see warning. | ||
# MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=0-1-2 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
Case: Stop GTID after EOF, must see warning. | ||
# MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=1-1-9 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
WARNING: Did not reach stop position 1-1-9 before end of input | ||
Case: Stop GTID nonexistent, must see warning. | ||
# MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=9-1-1 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
WARNING: Did not reach stop position 9-1-1 before end of input | ||
Case: Stop GTID at EOF + after EOF, must see only one warning. | ||
# MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=0-1-2,1-1-9 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
WARNING: Did not reach stop position 1-1-9 before end of input | ||
Case: Stop GTID after EOF + nonexistent, must see two warnings. | ||
# MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=1-1-9,9-1-1 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
WARNING: Did not reach stop position 9-1-1 before end of input | ||
WARNING: Did not reach stop position 1-1-9 before end of input | ||
DROP TABLE t1; | ||
DROP TABLE t2; | ||
# End of binlog_mysqlbinlog_warn_stop_gtid.test |
50 changes: 50 additions & 0 deletions
50
mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_gtid.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--echo | ||
--echo # MDEV-34614 mysqlbinlog warn on EOF before GTID in --stop-position | ||
--echo | ||
|
||
--source include/have_log_bin.inc | ||
|
||
--let ignored_output_file= $MYSQLTEST_VARDIR/tmp/warn_pos_test_file.out | ||
|
||
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), (2); | ||
SET @@session.gtid_domain_id= 1; | ||
CREATE TABLE t2(a int); | ||
INSERT INTO t2 VALUES (3); | ||
--let MYSQLD_DATADIR= `SELECT @@datadir;` | ||
FLUSH LOGS; | ||
|
||
--echo Case: Default, must not see warning. | ||
--echo # MYSQL_BINLOG --short-form MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 | ||
|
||
--echo Case: Stop GTID at EOF, must not see warning. | ||
--echo # MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=0-1-2 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
--exec $MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=0-1-2 $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 | ||
|
||
--echo Case: Stop GTID after EOF, must see warning. | ||
--echo # MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=1-1-9 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
--exec $MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=1-1-9 $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 | ||
|
||
--echo Case: Stop GTID nonexistent, must see warning. | ||
--echo # MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=9-1-1 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
--exec $MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=9-1-1 $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 | ||
|
||
--echo Case: Stop GTID at EOF + after EOF, must see only one warning. | ||
--echo # MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=0-1-2,1-1-9 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
--exec $MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=0-1-2,1-1-9 $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 | ||
|
||
--echo Case: Stop GTID after EOF + nonexistent, must see two warnings. | ||
--echo # MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=1-1-9,9-1-1 MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file | ||
--exec $MYSQL_BINLOG --short-form --skip-gtid-strict-mode --stop-position=1-1-9,9-1-1 $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 | ||
|
||
DROP TABLE t1; | ||
DROP TABLE t2; | ||
|
||
--remove_file $ignored_output_file | ||
|
||
--echo # End of binlog_mysqlbinlog_warn_stop_gtid.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters