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

--source include/have_log_bin.inc

--echo ###############################
--echo #      Test Setup
--echo ###############################

## Save old state
#
let orig_gtid_domain_id = `select @@session.gtid_domain_id`;
let orig_server_id = `select @@session.server_id`;
RESET MASTER;

--echo ####################################################
--echo #      Test Case Group 1
--echo #
--echo # Tests with --gtid-strict-mode should error and
--echo # immediately quit with error on out of order GTIDs
--echo ####################################################
--let is_strict_mode= 1
--let is_verbose= 0
--let DEFAULT_ERROR_PREFIX=ERROR
--source include/mysqlbinlog_gtid_strict_mode.inc

--echo ####################################################
--echo #      Test Case Group 2
--echo #
--echo # Test cases with --skip-gtid-strict-mode -vvv
--echo # should not quit early or with error when
--echo # encountering out of order GTIDs; however should
--echo # produce warnings after binlog processing
--echo ####################################################
--let is_strict_mode= 0
--let is_verbose= 1
--let DEFAULT_ERROR_PREFIX=WARNING
--source include/mysqlbinlog_gtid_strict_mode.inc

--echo ####################################################
--echo #      Test Case Group 3
--echo #
--echo # Run test cases with --skip-gtid-strict-mode should
--echo # neither produce errors nor warnings when
--echo # encountering out of order GTIDs
--echo ####################################################
--let is_strict_mode= 0
--let is_verbose= 0
--let DEFAULT_ERROR_PREFIX=(ERROR|WARNING)
--source include/mysqlbinlog_gtid_strict_mode.inc

--echo ##############################
--echo #      Cleanup
--echo ##############################
--eval SET @@global.gtid_domain_id= $orig_gtid_domain_id
--eval SET @@global.server_id= $orig_server_id

--echo End of the tests