File: rpl_timestamps_line_topology_cross_version.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (169 lines) | stat: -rw-r--r-- 5,366 bytes parent folder | download
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#
# ==== Purpose ====
#
# This test checks if the immediate_commit_timestamp (ICT) and the
# original_commit_timestamp (OCT) are generated and replicated correctly in two
# cross-version scenarios, in which one server in the begining or middle of the
# chain has no support for these timestamps.
#
# ==== Implementation ====
#
# Considering the following replication chain, we test two scenarios:
#   A: server_1 (MySQL5.7-) -> server_2 (MySQL5.8) -> server_3 (MySQL5.8)
#   B: server_1 (MySQL5.8) -> server_2 (MySQL5.7-) -> server_3 (MySQL5.8)
# In each scenario we generate a transaction and make the following assertions
# regarding ICT and OCT:
# Scenario A: 1- OCT is zero in both 5.8 servers because 5.7 did not generate
#                that information.
#             2- ICT exists in both 5.8 servers
# Scenario B: 1- OCT and ICT are the same in server_1.
#             2- ICT exists in server_3.
#             3- OCT does not exist in server_3 because server_2 has no support
#                for this information.
#
#
# ==== References ====
#
# WL#7319  Infrastructure for correct replication lag monitoring


# Legend:
#   OCT: original_commit_timestamp
#   ICT: immediate_commit_timestamp

--source include/have_debug.inc
--source include/have_binlog_format_row.inc

# Establish the line topology.
--let $rpl_topology=1->2, 2->3
--source include/rpl_init.inc

--echo # A. First server in the replication chain is not 5.8

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc

--let $debug_point= do_not_write_rpl_timestamps
--source include/add_debug_point.inc

--echo # A1. Execute a transaction and sync it on all the servers.

CREATE TABLE t1 (a INT);

--source include/rpl_sync.inc

--echo # A2. Collect both timestamps (original/immediate) from servers 2 and 3.

# Switch to server_1, to collect the corrresponding GTID.
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc

--let $server_uuid= query_get_value(select @@global.server_uuid, @@global.server_uuid, 1)
--let $gtid= $server_uuid:1

# Switch to server_2, save both OCT and ICT.
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc

--source include/get_original_commit_timestamp.inc
--let $server_2_OCT= $original_commit_timestamp

--source include/get_immediate_commit_timestamp.inc
--let $server_2_ICT= $immediate_commit_timestamp

# Switch to server_3, save both OCT and ICT.
--let $rpl_connection_name= server_3
--source include/rpl_connection.inc

--source include/get_original_commit_timestamp.inc
--let $server_3_OCT= $original_commit_timestamp

--source include/get_immediate_commit_timestamp.inc
--let $server_3_ICT= $immediate_commit_timestamp

--echo # A3. Verify that the timestamps are correct.

--let $assert_text= Assert that the OCT is zero in server_2.
--let $assert_cond= $server_2_OCT = 0
--source include/assert.inc

--let $assert_text= Assert that the OCT is zero in server_3.
--let $assert_cond= $server_3_OCT = 0
--source include/assert.inc

--let $assert_text= Assert that ICT exists in server_2.
--let $assert_cond= $server_2_ICT > 0
--source include/assert.inc

--let $assert_text= Assert that ICT exists in server_3.
--let $assert_cond= $server_3_ICT > 0
--source include/assert.inc

--echo # A4. Cleanup
# Switch to server_1, to remove debug_point
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--source include/remove_debug_point.inc

--echo # B. Server in the middle of the replication chain is not 5.8

--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--let $debug_point= do_not_write_rpl_timestamps
--source include/add_debug_point.inc

--echo # B1. Execute a transaction and sync it on all the servers.

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc

DROP TABLE t1;

--source include/rpl_sync.inc

--echo # B2. Collect both timestamps (original/immediate) from servers 1 and 3.

# Switch to server_1, save both OCT and ICT.
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc

--let $server_uuid= query_get_value(select @@global.server_uuid, @@global.server_uuid, 1)
--let $gtid= $server_uuid:2

--source include/get_original_commit_timestamp.inc
--let $server_1_OCT= $original_commit_timestamp

--source include/get_immediate_commit_timestamp.inc
--let $server_1_ICT= $immediate_commit_timestamp

# Switch to server_3, save both OCT and ICT.
--let $rpl_connection_name= server_3
--source include/rpl_connection.inc

--source include/get_original_commit_timestamp.inc
--let $server_3_OCT= $original_commit_timestamp

--source include/get_immediate_commit_timestamp.inc
--let $server_3_ICT= $immediate_commit_timestamp

--echo # B3. Verify that the timestamps are correct.

--let $assert_text= Assert that OCT is same as ICT on server_1 (originating server).
--let $assert_cond= $server_1_OCT = $server_1_ICT
--source include/assert.inc

--let $assert_text= Assert that ICT exists in server_3.
--let $assert_cond= $server_3_ICT > 0
--source include/assert.inc

--let $assert_text= Assert that the OCT is zero in server 3.
--let $assert_cond= $server_3_OCT = 0
--source include/assert.inc

--echo # B4. Cleanup
# Switch to server_2, to remove debug_point
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--source include/remove_debug_point.inc

--source include/rpl_end.inc