File: rpl_multi_source_basic.result

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 (246 lines) | stat: -rw-r--r-- 8,291 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#
# set up masters server_1 and server_3 with server_2 being a slave.
#.
include/rpl_init.inc [topology=1->2,3->2]
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
Warnings:
Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
Note	####	Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
#
# Test case 1: 1.a) create a database and table db1.t1 on server_1
#                   and insert values in the table.
[connection server_1]
CREATE DATABASE db1;
CREATE TABLE db1.t1 ( a int);
INSERT INTO db1.t1 VALUES (10);
INSERT INTO db1.t1 VALUES (9);
INSERT INTO db1.t1 VALUES (8);
INSERT INTO db1.t1 VALUES (7);
INSERT INTO db1.t1 VALUES (6);
INSERT INTO db1.t1 VALUES (5);
INSERT INTO db1.t1 VALUES (4);
INSERT INTO db1.t1 VALUES (3);
INSERT INTO db1.t1 VALUES (2);
INSERT INTO db1.t1 VALUES (1);
SHOW DATABASES;
Database
db1
information_schema
mtr
mysql
performance_schema
sys
test
#
# 1.b  create database and table db3.t1 on server_3
#      and insert values in db3.t1
[connection server_3]
CREATE DATABASE db3;
CREATE TABLE db3.t1 (a int);
INSERT INTO db3.t1 VALUES (3*10);
INSERT INTO db3.t1 VALUES (3*9);
INSERT INTO db3.t1 VALUES (3*8);
INSERT INTO db3.t1 VALUES (3*7);
INSERT INTO db3.t1 VALUES (3*6);
INSERT INTO db3.t1 VALUES (3*5);
INSERT INTO db3.t1 VALUES (3*4);
INSERT INTO db3.t1 VALUES (3*3);
INSERT INTO db3.t1 VALUES (3*2);
INSERT INTO db3.t1 VALUES (3*1);
SHOW DATABASES;
Database
db3
information_schema
mtr
mysql
performance_schema
sys
test
#
# 1.c  sync the slave (server_2) with both masters (server_1 and server_3)
#
[connection server_1]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_1']
[connection server_3]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_3']
#
# 1.d Check that slave has replicated from both masters.
#  Slave should have databases db1 and db3 and tables.
SHOW DATABASES;
Database
db1
db3
information_schema
mtr
mysql
performance_schema
sys
test
include/assert.inc [Slave should have 10 rows in db1.t1]
include/assert.inc [Slave should have 10 rows in db3.t1]
#
# Stop slave (on server_2) for test case 2.
#
include/rpl_stop_slaves.inc
#
#  Test case 2: 2.a) Test that different tables in the same database
#                    are replicated to the slave
[connection server_1]
CREATE DATABASE dbcommon;
[connection server_2]
include/start_slave.inc [FOR CHANNEL 'channel_1']
[connection server_1]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_1']
include/stop_slave.inc [FOR CHANNEL 'channel_1']
[connection server_1]
CREATE TABLE dbcommon.t11(a int);
INSERT INTO dbcommon.t11 values (11*10);
INSERT INTO dbcommon.t11 values (11*9);
INSERT INTO dbcommon.t11 values (11*8);
INSERT INTO dbcommon.t11 values (11*7);
INSERT INTO dbcommon.t11 values (11*6);
INSERT INTO dbcommon.t11 values (11*5);
INSERT INTO dbcommon.t11 values (11*4);
INSERT INTO dbcommon.t11 values (11*3);
INSERT INTO dbcommon.t11 values (11*2);
INSERT INTO dbcommon.t11 values (11*1);
[connection server_3]
CREATE DATABASE IF NOT EXISTS dbcommon;
CREATE TABLE dbcommon.t33(a int);
INSERT INTO dbcommon.t33 values(33*10);
INSERT INTO dbcommon.t33 values(33*9);
INSERT INTO dbcommon.t33 values(33*8);
INSERT INTO dbcommon.t33 values(33*7);
INSERT INTO dbcommon.t33 values(33*6);
INSERT INTO dbcommon.t33 values(33*5);
INSERT INTO dbcommon.t33 values(33*4);
INSERT INTO dbcommon.t33 values(33*3);
INSERT INTO dbcommon.t33 values(33*2);
INSERT INTO dbcommon.t33 values(33*1);
#
# 2.b Start replication from the masters
#
[connection server_2]
include/rpl_start_slaves.inc
#
#  2.c sync the slave with both masters
#
[connection server_1]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_1']
[connection server_3]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_3']
#
#  2.d Now check the data
#
SHOW DATABASES;
Database
db1
db3
dbcommon
information_schema
mtr
mysql
performance_schema
sys
test
USE dbcommon;
SHOW TABLES;
Tables_in_dbcommon
t11
t33
include/assert.inc [Slave should have 10 rows in dbcommon.t11]
include/assert.inc [Slave should have 10 rows in dbcommon.t33]
#
# Test case 3: 3.a) Update nonconflicting data on the same table
#                 and see if they are replicated to the slave.
[connection server_1]
CREATE TABLE dbcommon.t101(a int, PRIMARY KEY (a));
[connection server_1]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_1']
#
# Stop slave (on server_2) for test case 3.
#
include/rpl_stop_slaves.inc
[connection server_1]
INSERT INTO dbcommon.t101 values (101*10);
INSERT INTO dbcommon.t101 values (101*9);
INSERT INTO dbcommon.t101 values (101*8);
INSERT INTO dbcommon.t101 values (101*7);
INSERT INTO dbcommon.t101 values (101*6);
INSERT INTO dbcommon.t101 values (101*5);
INSERT INTO dbcommon.t101 values (101*4);
INSERT INTO dbcommon.t101 values (101*3);
INSERT INTO dbcommon.t101 values (101*2);
INSERT INTO dbcommon.t101 values (101*1);
[connection server_3]
CREATE TABLE IF NOT EXISTS dbcommon.t101(a int, PRIMARY KEY (a));
INSERT INTO dbcommon.t101 values(33*10);
INSERT INTO dbcommon.t101 values(33*9);
INSERT INTO dbcommon.t101 values(33*8);
INSERT INTO dbcommon.t101 values(33*7);
INSERT INTO dbcommon.t101 values(33*6);
INSERT INTO dbcommon.t101 values(33*5);
INSERT INTO dbcommon.t101 values(33*4);
INSERT INTO dbcommon.t101 values(33*3);
INSERT INTO dbcommon.t101 values(33*2);
INSERT INTO dbcommon.t101 values(33*1);
#
#  3.b Start replication from the masters
#
[connection server_2]
include/rpl_start_slaves.inc
#
# 3.c sync slave server with all the masters.
#
[connection server_1]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_1']
[connection server_3]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_3']
#
#  check that data has been replicated to the slave.
#
USE dbcommon;
SHOW TABLES;
Tables_in_dbcommon
t101
t11
t33
include/assert.inc [Slave should have 20 rows in dbcommon.t101]
#
# Test case 4: Update tables on both masters with conflicting data
#              In this case, slave shall stop on a SQL thread.
# 4.a) Do an update on server_1 and sync with the slave.
[connection server_1]
INSERT INTO dbcommon.t101 values(1729);
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_1']
# 4.b) Do a conflicting update on server_3 and check for conflicting error
[connection server_3]
INSERT INTO dbcommon.t101 values (1729);
[connection server_2]
call mtr.add_suppression("Replica SQL.*:.* 'Duplicate entry '1729' for key 't101.PRIMARY'' on query.*");
call mtr.add_suppression("Replica SQL.*: Could not execute Write_rows event on table dbcommon.t101; Duplicate entry '1729' for key 't101.PRIMARY'*");
call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
call mtr.add_suppression("Replica SQL.*:.* Duplicate entry '1729' for key 't101.PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY.*");
include/wait_for_slave_sql_error.inc [errno=1062 FOR CHANNEL 'channel_3']
include/assert.inc [Value returned by SSS and PS table for Last_Error_Number should be same.]
DELETE FROM dbcommon.t101 where a=1729;
include/start_slave.inc [FOR CHANNEL 'channel_3']
# channel 1
[connection server_1]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_1']
# channel 3
[connection server_3]
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_3']
connection_server_1
DROP DATABASE db1;
DROP DATABASE dbcommon;
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_1']
connection_server_3
DROP DATABASE db3;
DROP DATABASE IF EXISTS dbcommon;
include/sync_slave_sql_with_master.inc [FOR CHANNEL 'channel_3']
include/rpl_end.inc
RESET REPLICA ALL FOR CHANNEL 'channel_1';
RESET REPLICA ALL FOR CHANNEL 'channel_3';