File: gr_xplugin_basic_dml.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 (222 lines) | stat: -rw-r--r-- 7,995 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
##############################################################################
#
# This test checks the basic functionality of group replication plugin along
# with mysqlx plugin.
#
# NOTE : All queries will be run through mysqlx plugin using mysqlxtest.
#
# Steps involved in this test :
# 0. This test requires 3 servers.
# 1. Start 3 servers loaded with both mysqlx and group replication plugin.
# 2. Start group replication on server1 as bootstrap server for the group.
# 3. Start group replication on other two servers as non bootstrap server.
# 4. Wait until all three servers come online.
# 5. Perform ddl and dml operations on all the three servers.
#    a) server1 : Create table T1 and perform ddl on T1.
#    b) server2 : Create table T2 and perform ddl on T1 & T2.
#    c) server3 : Create table T3 and perform ddl on T1,T2 & T3.
# 6. Assert for values on three tables from different servers.
# 7. Stop group replication on all the servers through mysqlx.
# 8. uninstall mysqlx plugin on all servers.
# 9. clean-up
##############################################################################

--source include/big_test.inc
--source include/have_mysqlx_plugin.inc
--source include/have_group_replication_plugin_base.inc

# This initial setup starts three servers with all the prerequisites required
# for GR to start

--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source include/group_replication.inc

# Install Mysqlx plugin on all servers.

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/xplugin_wait_for_interfaces.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/xplugin_wait_for_interfaces.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/xplugin_wait_for_interfaces.inc

# File for starting GR through X-protocol
# Bootstrap-server
--write_file $MYSQL_TMP_DIR/bootstrap_server.tmp
-->sql
SET GLOBAL GROUP_REPLICATION_GROUP_NAME = 'aaaaaaaa-dddd-aaaa-aaaa-aaaaaaaaaaaa';
SET GLOBAL GROUP_REPLICATION_BOOTSTRAP_GROUP=1;
START GROUP_REPLICATION;
SET GLOBAL GROUP_REPLICATION_BOOTSTRAP_GROUP=0;
-->endsql
EOF

# Temp file for starting group replication as non bootstrap server.
--write_file $MYSQL_TMP_DIR/non_bootstrap_server.tmp
-->sql
SET GLOBAL GROUP_REPLICATION_GROUP_NAME = 'aaaaaaaa-dddd-aaaa-aaaa-aaaaaaaaaaaa';
CHANGE REPLICATION SOURCE TO SOURCE_USER='root' FOR CHANNEL 'group_replication_recovery';
START GROUP_REPLICATION;
-->endsql
EOF

# Starting GR on all the servers through mysqlx
--echo Starting GR on server 1
--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_1 --file=$MYSQL_TMP_DIR/bootstrap_server.tmp 2>&1
--echo Starting GR on server 2
--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_2 --file=$MYSQL_TMP_DIR/non_bootstrap_server.tmp 2>&1
--echo Starting GR on server 3
--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_3 --file=$MYSQL_TMP_DIR/non_bootstrap_server.tmp 2>&1

--echo Waiting for GR members to come online.
--let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE"
--source include/wait_condition.inc

# Temp file for performing ddl and dml on server1

--write_file $MYSQL_TMP_DIR/ddl_dml_on_server1.tmp
-->sql
USE test;
CREATE TABLE T1 (C1 INT PRIMARY KEY, C2 INT );
INSERT INTO T1 VALUES (1,12);
INSERT INTO T1 VALUES (2,1234);
INSERT INTO T1 VALUES (3,98765);
UPDATE T1 SET C2 = C2 - 98765;
DELETE FROM T1 WHERE C2 = 0;
-->endsql
EOF

--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_1 --file=$MYSQL_TMP_DIR/ddl_dml_on_server1.tmp 2>&1

# Wait for synchronization between the nodes.

--source include/rpl_sync.inc

# Temp file for performing ddl and dml on server2

--write_file $MYSQL_TMP_DIR/ddl_dml_on_server2.tmp
-->sql
USE test;
CREATE TABLE T2 (C1 CHAR(20) PRIMARY KEY, C2 INT );
INSERT INTO T2 VALUES ('ABC',23);
UPDATE T2 SET C2 = C2 + 27;
INSERT INTO T1 VALUES (4,34);
INSERT INTO T2 VALUES ('ABCDEF',23);
INSERT INTO T1 VALUES (5,1234);
INSERT INTO T2 VALUES ('ABCDEFGHIJ',23);
DELETE FROM T2 WHERE C1 = 'ABC';
-->endsql
EOF

--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_2 --file=$MYSQL_TMP_DIR/ddl_dml_on_server2.tmp 2>&1

# Wait for synchronization between the nodes.

--source include/rpl_sync.inc

# Temp file for performing ddl and dml on server3

--write_file $MYSQL_TMP_DIR/ddl_dml_on_server3.tmp
-->sql
USE test;
CREATE TABLE T3 (C1 INT PRIMARY KEY, C2 VARCHAR(20) );
DELETE FROM T1;
INSERT INTO T1 VALUES (1,12345);
INSERT INTO T3 VALUES (1,'1234');
INSERT INTO T2 VALUES ('1234',1234);
INSERT INTO T1 VALUES (7,98765);
INSERT INTO T2 VALUES ('XYZ',23);
UPDATE T2 SET C1 = 'ABC' WHERE C1 ='XYZ';
INSERT INTO T3 VALUES (2,'23');
INSERT INTO T3 VALUES (3,'234');
DELETE FROM T3 WHERE C1 > 0;
-->endsql
EOF

--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_3 --file=$MYSQL_TMP_DIR/ddl_dml_on_server3.tmp 2>&1

# Wait for synchronization between the nodes.

--source include/rpl_sync.inc

# Asserts for values on each table.

--write_file $MYSQL_TMP_DIR/assert.tmp

-->echo Checking the Value on T1
-->wait_for 12345	SELECT C2 FROM test.T1 WHERE C1=1

-->echo Checking the row_count on T2
-->wait_for 23	SELECT C2 FROM test.T2 WHERE C1="ABC"
EOF

--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_3 --file=$MYSQL_TMP_DIR/assert.tmp 2>&1

--let $wait_condition=SELECT COUNT(*)=0 FROM test.T3
--source include/wait_condition.inc

# Temp for droping tables in a group.
--write_file $MYSQL_TMP_DIR/delete_tables.tmp
-->sql
USE test;
DROP TABLE T1;
DROP TABLE T2;
DROP TABLE T3;
-->endsql
EOF

# Deleting tables.
--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_3 --file=$MYSQL_TMP_DIR/delete_tables.tmp 2>&1
--source include/rpl_sync.inc

# Creating temp file to stop GR.
--write_file $MYSQL_TMP_DIR/stop_group_replication.tmp
-->stmtsql STOP GROUP_REPLICATION;
-->recvresult
EOF

# Stopping GR on all the servers
--echo Stopping GR on server 1
--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_1 --file=$MYSQL_TMP_DIR/stop_group_replication.tmp 2>&1
--echo Stopping GR on server 2
--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_2 --file=$MYSQL_TMP_DIR/stop_group_replication.tmp 2>&1
--echo Stopping GR on server 3
--exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_3 --file=$MYSQL_TMP_DIR/stop_group_replication.tmp 2>&1

# Uninstall mysqlx on all servers
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $group_replication_member_state= OFFLINE
--source include/gr_wait_for_member_state.inc
--source include/assert_and_disable_read_only.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $group_replication_member_state= OFFLINE
--source include/gr_wait_for_member_state.inc
--source include/assert_and_disable_read_only.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $group_replication_member_state= OFFLINE
--source include/gr_wait_for_member_state.inc
--source include/assert_and_disable_read_only.inc

# clean-up
--remove_file $MYSQL_TMP_DIR/bootstrap_server.tmp
--remove_file $MYSQL_TMP_DIR/non_bootstrap_server.tmp
--remove_file $MYSQL_TMP_DIR/ddl_dml_on_server1.tmp
--remove_file $MYSQL_TMP_DIR/ddl_dml_on_server2.tmp
--remove_file $MYSQL_TMP_DIR/ddl_dml_on_server3.tmp
--remove_file $MYSQL_TMP_DIR/delete_tables.tmp
--remove_file $MYSQL_TMP_DIR/assert.tmp
--remove_file $MYSQL_TMP_DIR/stop_group_replication.tmp

--source include/group_replication_end.inc