Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_timestamps_line_topology_cross_version.test

raw
1 #
2 # ==== Purpose ====
3 #
4 # This test checks if the immediate_commit_timestamp (ICT) and the
5 # original_commit_timestamp (OCT) are generated and replicated correctly in two
6 # cross-version scenarios, in which one server in the begining or middle of the
7 # chain has no support for these timestamps.
8 #
9 # ==== Implementation ====
10 #
11 # Considering the following replication chain, we test two scenarios:
12 # A: server_1 (MySQL5.7-) -> server_2 (MySQL5.8) -> server_3 (MySQL5.8)
13 # B: server_1 (MySQL5.8) -> server_2 (MySQL5.7-) -> server_3 (MySQL5.8)
14 # In each scenario we generate a transaction and make the following assertions
15 # regarding ICT and OCT:
16 # Scenario A: 1- OCT is zero in both 5.8 servers because 5.7 did not generate
17 # that information.
18 # 2- ICT exists in both 5.8 servers
19 # Scenario B: 1- OCT and ICT are the same in server_1.
20 # 2- ICT exists in server_3.
21 # 3- OCT does not exist in server_3 because server_2 has no support
22 # for this information.
23 #
24 #
25 # ==== References ====
26 #
27 # WL#7319 Infrastructure for correct replication lag monitoring
28
29
30 # Legend:
31 # OCT: original_commit_timestamp
32 # ICT: immediate_commit_timestamp
33
34 --source include/have_debug.inc
35 --source include/have_binlog_format_row.inc
36
37 # Establish the line topology.
38 --let $rpl_topology=1->2, 2->3
39 --source include/rpl_init.inc
40
41 --echo # A. First server in the replication chain is not 5.8
42
43 --let $rpl_connection_name= server_1
44 --source include/rpl_connection.inc
45
46 --let $debug_point= do_not_write_rpl_timestamps
47 --source include/add_debug_point.inc
48
49 --echo # A1. Execute a transaction and sync it on all the servers.
50
51 CREATE TABLE t1 (a INT);
52
53 --source include/rpl_sync.inc
54
55 --echo # A2. Collect both timestamps (original/immediate) from servers 2 and 3.
56
57 # Switch to server_1, to collect the corrresponding GTID.
58 --let $rpl_connection_name= server_1
59 --source include/rpl_connection.inc
60
61 --let $server_uuid= query_get_value(select @@global.server_uuid, @@global.server_uuid, 1)
62 --let $gtid= $server_uuid:1
63
64 # Switch to server_2, save both OCT and ICT.
65 --let $rpl_connection_name= server_2
66 --source include/rpl_connection.inc
67
68 --source include/get_original_commit_timestamp.inc
69 --let $server_2_OCT= $original_commit_timestamp
70
71 --source include/get_immediate_commit_timestamp.inc
72 --let $server_2_ICT= $immediate_commit_timestamp
73
74 # Switch to server_3, save both OCT and ICT.
75 --let $rpl_connection_name= server_3
76 --source include/rpl_connection.inc
77
78 --source include/get_original_commit_timestamp.inc
79 --let $server_3_OCT= $original_commit_timestamp
80
81 --source include/get_immediate_commit_timestamp.inc
82 --let $server_3_ICT= $immediate_commit_timestamp
83
84 --echo # A3. Verify that the timestamps are correct.
85
86 --let $assert_text= Assert that the OCT is zero in server_2.
87 --let $assert_cond= $server_2_OCT = 0
88 --source include/assert.inc
89
90 --let $assert_text= Assert that the OCT is zero in server_3.
91 --let $assert_cond= $server_3_OCT = 0
92 --source include/assert.inc
93
94 --let $assert_text= Assert that ICT exists in server_2.
95 --let $assert_cond= $server_2_ICT > 0
96 --source include/assert.inc
97
98 --let $assert_text= Assert that ICT exists in server_3.
99 --let $assert_cond= $server_3_ICT > 0
100 --source include/assert.inc
101
102 --echo # A4. Cleanup
103 # Switch to server_1, to remove debug_point
104 --let $rpl_connection_name= server_1
105 --source include/rpl_connection.inc
106 --source include/remove_debug_point.inc
107
108 --echo # B. Server in the middle of the replication chain is not 5.8
109
110 --let $rpl_connection_name= server_2
111 --source include/rpl_connection.inc
112 --let $debug_point= do_not_write_rpl_timestamps
113 --source include/add_debug_point.inc
114
115 --echo # B1. Execute a transaction and sync it on all the servers.
116
117 --let $rpl_connection_name= server_1
118 --source include/rpl_connection.inc
119
120 DROP TABLE t1;
121
122 --source include/rpl_sync.inc
123
124 --echo # B2. Collect both timestamps (original/immediate) from servers 1 and 3.
125
126 # Switch to server_1, save both OCT and ICT.
127 --let $rpl_connection_name= server_1
128 --source include/rpl_connection.inc
129
130 --let $server_uuid= query_get_value(select @@global.server_uuid, @@global.server_uuid, 1)
131 --let $gtid= $server_uuid:2
132
133 --source include/get_original_commit_timestamp.inc
134 --let $server_1_OCT= $original_commit_timestamp
135
136 --source include/get_immediate_commit_timestamp.inc
137 --let $server_1_ICT= $immediate_commit_timestamp
138
139 # Switch to server_3, save both OCT and ICT.
140 --let $rpl_connection_name= server_3
141 --source include/rpl_connection.inc
142
143 --source include/get_original_commit_timestamp.inc
144 --let $server_3_OCT= $original_commit_timestamp
145
146 --source include/get_immediate_commit_timestamp.inc
147 --let $server_3_ICT= $immediate_commit_timestamp
148
149 --echo # B3. Verify that the timestamps are correct.
150
151 --let $assert_text= Assert that OCT is same as ICT on server_1 (originating server).
152 --let $assert_cond= $server_1_OCT = $server_1_ICT
153 --source include/assert.inc
154
155 --let $assert_text= Assert that ICT exists in server_3.
156 --let $assert_cond= $server_3_ICT > 0
157 --source include/assert.inc
158
159 --let $assert_text= Assert that the OCT is zero in server 3.
160 --let $assert_cond= $server_3_OCT = 0
161 --source include/assert.inc
162
163 --echo # B4. Cleanup
164 # Switch to server_2, to remove debug_point
165 --let $rpl_connection_name= server_2
166 --source include/rpl_connection.inc
167 --source include/remove_debug_point.inc
168
169 --source include/rpl_end.inc