Debian Codegraph @

mysql-test/suite/binlog/t/binlog_mysqlbinlog_gtid_strict_mode.test

raw
1 #
2 # Purpose:
3 #
4 # This test ensures that the mariadb-binlog CLI tool properly displays errors
5 # and warnings for out of order GTIDs.
6 #
7 #
8 # Methodology:
9 #
10 # We simulate invalid sequence numberings by manually changing gtid_seq_no to
11 # differ from its expected linear sequence. Specifically, we test the following
12 # cases:
13 # Test Case 1) Sequential sequence numbers results in no warnings
14 # Test Case 2) A skipped sequence number results in no warnings if all numbers
15 # are monotonic (i.e. gaps in sequence number are allowed
16 # provided they never decrease)
17 # Test Case 3) A sequence number lower than the last processed value results
18 # in a warning
19 # Test Case 4) Skipping a GTID and later receiving it results in a warning
20 # Test Case 5) Repeat sequence numbers result in a warning
21 # Test Case 6) Warnings from different domains are all displayed
22 # Test Case 7) A decreasing seq_no before a start-position is ignored
23 # Test Case 8) A decreasing seq_no inside of a --start/--stop position window
24 # is displayed
25 # Test Case 9) Error if --stop-position is not greater than or equal to
26 # --start-position
27 # Test Case 10) Strict mode warnings should be independent of --offset option
28 # specification
29 # Test Case 11) Strict mode warnings should be independent of
30 # --start-timestamp option specification
31 # Test Case 12) Specifying multiple binary logs with a log-position start
32 # should skip GTID state verification
33 # Test Case 13) If multiple binary logs should be specified but a middle log
34 # is missing, we should detect that and warn when using -vvv
35 # Test Case 14) If a --stop-position GTID occurs before the first specified
36 # binlog's GLLE, error
37 #
38 # Note that test cases are tested under three scenarios:
39 # 1) --gtid-strict-mode should error and immediately quit with error on out of
40 # order GTIDs
41 # 2) --skip-gtid-strict-mode -vvv should not quit early or with error when
42 # encountering out of order GTIDs; however should produce warnings after
43 # binlog processing
44 # 3) --skip-gtid-strict-mode should neither produce errors nor warnings when
45 # encountering out of order GTIDs
46 #
47 # References:
48 # MDEV-4989: Support for GTID in mysqlbinlog
49 #
50
51 --source include/have_log_bin.inc
52
53 --echo ###############################
54 --echo # Test Setup
55 --echo ###############################
56
57 ## Save old state
58 #
59 let orig_gtid_domain_id = `select @@session.gtid_domain_id`;
60 let orig_server_id = `select @@session.server_id`;
61 RESET MASTER;
62
63 --echo ####################################################
64 --echo # Test Case Group 1
65 --echo #
66 --echo # Tests with --gtid-strict-mode should error and
67 --echo # immediately quit with error on out of order GTIDs
68 --echo ####################################################
69 --let is_strict_mode= 1
70 --let is_verbose= 0
71 --let DEFAULT_ERROR_PREFIX=ERROR
72 --source include/mysqlbinlog_gtid_strict_mode.inc
73
74 --echo ####################################################
75 --echo # Test Case Group 2
76 --echo #
77 --echo # Test cases with --skip-gtid-strict-mode -vvv
78 --echo # should not quit early or with error when
79 --echo # encountering out of order GTIDs; however should
80 --echo # produce warnings after binlog processing
81 --echo ####################################################
82 --let is_strict_mode= 0
83 --let is_verbose= 1
84 --let DEFAULT_ERROR_PREFIX=WARNING
85 --source include/mysqlbinlog_gtid_strict_mode.inc
86
87 --echo ####################################################
88 --echo # Test Case Group 3
89 --echo #
90 --echo # Run test cases with --skip-gtid-strict-mode should
91 --echo # neither produce errors nor warnings when
92 --echo # encountering out of order GTIDs
93 --echo ####################################################
94 --let is_strict_mode= 0
95 --let is_verbose= 0
96 --let DEFAULT_ERROR_PREFIX=(ERROR|WARNING)
97 --source include/mysqlbinlog_gtid_strict_mode.inc
98
99 --echo ##############################
100 --echo # Cleanup
101 --echo ##############################
102 --eval SET @@global.gtid_domain_id= $orig_gtid_domain_id
103 --eval SET @@global.server_id= $orig_server_id
104
105 --echo End of the tests