| 1 |
############################################################################### |
| 2 |
# WL#11610 |
| 3 |
# Perform some simple tests about getting/setting communication_protocol. |
| 4 |
# |
| 5 |
# This test uses 2 servers. |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 1. Start 2 servers and add them into group replication group. |
| 9 |
# 2. Decrease communication_protocol. |
| 10 |
# 3. Increase communication_protocol. |
| 11 |
# 4. Confirm invalid calls to group_replication_get_communication_protocol. |
| 12 |
# 5. Confirm invalid calls to group_replication_set_communication_protocol. |
| 13 |
# 6. Stop GR and try to call UDFs outside of a group. |
| 14 |
################################################################################ |
| 15 |
--source include/have_group_replication_plugin.inc |
| 16 |
--let $rpl_server_count= 2 |
| 17 |
--source include/group_replication.inc |
| 18 |
|
| 19 |
# Create table with strings to test UDF further down. |
| 20 |
SET SQL_LOG_BIN=0; |
| 21 |
CREATE TABLE t1 (i INT, s VARCHAR(16), PRIMARY KEY (i)); |
| 22 |
INSERT INTO t1 VALUES (1, NULL); |
| 23 |
INSERT INTO t1 VALUES (2, ""); |
| 24 |
INSERT INTO t1 VALUES (3, "5"); |
| 25 |
INSERT INTO t1 VALUES (4, "5.7"); |
| 26 |
INSERT INTO t1 VALUES (5, "5.7.14a"); |
| 27 |
INSERT INTO t1 VALUES (6, "5.7.13"); |
| 28 |
INSERT INTO t1 VALUES (7, "99.99.99"); |
| 29 |
SET SQL_LOG_BIN=1; |
| 30 |
|
| 31 |
# Will be used to hide the version of the server later on. |
| 32 |
--let $mysql_version= `SELECT SUBSTRING_INDEX(VERSION(), '-', 1)` |
| 33 |
|
| 34 |
--echo ############################################################################### |
| 35 |
--echo # 2. Decrease communication_protocol. |
| 36 |
--let $rpl_connection_name= server1 |
| 37 |
--source include/rpl_connection.inc |
| 38 |
|
| 39 |
--let $gr_new_protocol= 5.7.14 |
| 40 |
|
| 41 |
--eval SELECT group_replication_set_communication_protocol("$gr_new_protocol") |
| 42 |
|
| 43 |
--let $gr_protocol= `SELECT group_replication_get_communication_protocol()` |
| 44 |
--let $assert_text= communication_protocol is supposed to be $gr_new_protocol |
| 45 |
--let $assert_cond= "$gr_protocol" = "$gr_new_protocol" |
| 46 |
--source include/assert.inc |
| 47 |
|
| 48 |
--let $communication_protocol_table= query_get_value(SELECT protocol_version FROM performance_schema.replication_group_communication_information, protocol_version, 1) |
| 49 |
--let $assert_text= protocol_version ($communication_protocol_table) should be $gr_protocol |
| 50 |
--let $assert_cond= "$communication_protocol_table" = "$gr_protocol" |
| 51 |
--source include/assert.inc |
| 52 |
|
| 53 |
--let $rpl_connection_name= server2 |
| 54 |
--source include/rpl_connection.inc |
| 55 |
|
| 56 |
--let $gr_protocol= `SELECT group_replication_get_communication_protocol()` |
| 57 |
--let $assert_text= communication_protocol is supposed to be $gr_new_protocol |
| 58 |
--let $assert_cond= "$gr_protocol" = "$gr_new_protocol" |
| 59 |
--source include/assert.inc |
| 60 |
|
| 61 |
--let $communication_protocol_table= query_get_value(SELECT protocol_version FROM performance_schema.replication_group_communication_information, protocol_version, 1) |
| 62 |
--let $assert_text= protocol_version ($communication_protocol_table) should be $gr_protocol |
| 63 |
--let $assert_cond= "$communication_protocol_table" = "$gr_protocol" |
| 64 |
--source include/assert.inc |
| 65 |
|
| 66 |
--echo ############################################################################### |
| 67 |
--echo # 3. Increase communication_protocol. |
| 68 |
--let $gr_new_protocol= 8.0.16 |
| 69 |
|
| 70 |
--let $rpl_connection_name= server1 |
| 71 |
--source include/rpl_connection.inc |
| 72 |
|
| 73 |
--eval SELECT group_replication_set_communication_protocol("$gr_new_protocol") |
| 74 |
|
| 75 |
--let $gr_protocol= `SELECT group_replication_get_communication_protocol()` |
| 76 |
--let $assert_text= communication_protocol is supposed to be $gr_new_protocol |
| 77 |
--let $assert_cond= "$gr_protocol" = "$gr_new_protocol" |
| 78 |
--source include/assert.inc |
| 79 |
|
| 80 |
--let $communication_protocol_table= query_get_value(SELECT protocol_version FROM performance_schema.replication_group_communication_information, protocol_version, 1) |
| 81 |
--let $assert_text= protocol_version ($communication_protocol_table) should be $gr_protocol |
| 82 |
--let $assert_cond= "$communication_protocol_table" = "$gr_protocol" |
| 83 |
--source include/assert.inc |
| 84 |
|
| 85 |
--let $rpl_connection_name= server2 |
| 86 |
--source include/rpl_connection.inc |
| 87 |
|
| 88 |
--let $gr_protocol= `SELECT group_replication_get_communication_protocol()` |
| 89 |
--let $assert_text= communication_protocol is supposed to be $gr_new_protocol |
| 90 |
--let $assert_cond= "$gr_protocol" = "$gr_new_protocol" |
| 91 |
--source include/assert.inc |
| 92 |
|
| 93 |
--let $communication_protocol_table= query_get_value(SELECT protocol_version FROM performance_schema.replication_group_communication_information, protocol_version, 1) |
| 94 |
--let $assert_text= protocol_version ($communication_protocol_table) should be $gr_protocol |
| 95 |
--let $assert_cond= "$communication_protocol_table" = "$gr_protocol" |
| 96 |
--source include/assert.inc |
| 97 |
|
| 98 |
--echo ############################################################################### |
| 99 |
--echo # 4. Confirm invalid calls to group_replication_get_communication_protocol |
| 100 |
--let $rpl_connection_name= server1 |
| 101 |
--source include/rpl_connection.inc |
| 102 |
|
| 103 |
--error ER_CANT_INITIALIZE_UDF |
| 104 |
SELECT group_replication_get_communication_protocol(1); |
| 105 |
|
| 106 |
--error ER_CANT_INITIALIZE_UDF |
| 107 |
SELECT group_replication_get_communication_protocol(1.1); |
| 108 |
|
| 109 |
--error ER_CANT_INITIALIZE_UDF |
| 110 |
SELECT group_replication_get_communication_protocol("hehe"); |
| 111 |
|
| 112 |
--error ER_CANT_INITIALIZE_UDF |
| 113 |
SELECT group_replication_get_communication_protocol(NULL); |
| 114 |
|
| 115 |
--echo ############################################################################### |
| 116 |
--echo # 5. Confirm invalid calls to group_replication_set_communication_protocol |
| 117 |
--error ER_CANT_INITIALIZE_UDF |
| 118 |
SELECT group_replication_set_communication_protocol(); |
| 119 |
|
| 120 |
--error ER_CANT_INITIALIZE_UDF |
| 121 |
SELECT group_replication_set_communication_protocol(NULL); |
| 122 |
|
| 123 |
--error ER_CANT_INITIALIZE_UDF |
| 124 |
SELECT group_replication_set_communication_protocol(1); |
| 125 |
|
| 126 |
--error ER_CANT_INITIALIZE_UDF |
| 127 |
SELECT group_replication_set_communication_protocol(5.7); |
| 128 |
|
| 129 |
--error ER_CANT_INITIALIZE_UDF |
| 130 |
SELECT group_replication_set_communication_protocol(""); |
| 131 |
|
| 132 |
--error ER_CANT_INITIALIZE_UDF |
| 133 |
SELECT group_replication_set_communication_protocol(" "); |
| 134 |
|
| 135 |
--error ER_CANT_INITIALIZE_UDF |
| 136 |
SELECT group_replication_set_communication_protocol("5"); |
| 137 |
|
| 138 |
--error ER_CANT_INITIALIZE_UDF |
| 139 |
SELECT group_replication_set_communication_protocol("5.7"); |
| 140 |
|
| 141 |
--error ER_CANT_INITIALIZE_UDF |
| 142 |
SELECT group_replication_set_communication_protocol("5.7.14a"); |
| 143 |
|
| 144 |
# Out of [5.7.14, this-mysql-version] domain |
| 145 |
# We are using 99.99.99 as a placeholder for a version > than this-mysql-version |
| 146 |
--replace_result $mysql_version MYSQL_VERSION |
| 147 |
--error ER_CANT_INITIALIZE_UDF |
| 148 |
SELECT group_replication_set_communication_protocol("5.7.13"); |
| 149 |
|
| 150 |
--replace_result $mysql_version MYSQL_VERSION |
| 151 |
--error ER_CANT_INITIALIZE_UDF |
| 152 |
SELECT group_replication_set_communication_protocol("99.99.99"); |
| 153 |
|
| 154 |
# With dynamic arguments, the error returned is ER_GRP_RPL_UDF_ERROR |
| 155 |
|
| 156 |
# NULL |
| 157 |
--error ER_GRP_RPL_UDF_ERROR |
| 158 |
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=1; |
| 159 |
|
| 160 |
# Empty |
| 161 |
--error ER_GRP_RPL_UDF_ERROR |
| 162 |
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=2; |
| 163 |
|
| 164 |
# 5 |
| 165 |
--error ER_GRP_RPL_UDF_ERROR |
| 166 |
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=3; |
| 167 |
|
| 168 |
# 5.7 |
| 169 |
--error ER_GRP_RPL_UDF_ERROR |
| 170 |
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=4; |
| 171 |
|
| 172 |
#5.7.14a |
| 173 |
--error ER_GRP_RPL_UDF_ERROR |
| 174 |
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=5; |
| 175 |
|
| 176 |
#5.7.13 |
| 177 |
--replace_result $mysql_version MYSQL_VERSION |
| 178 |
--error ER_GRP_RPL_UDF_ERROR |
| 179 |
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=6; |
| 180 |
|
| 181 |
#99.99.99 |
| 182 |
--replace_result $mysql_version MYSQL_VERSION |
| 183 |
--error ER_GRP_RPL_UDF_ERROR |
| 184 |
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=7; |
| 185 |
|
| 186 |
|
| 187 |
# Stop GR on server2 |
| 188 |
--let $rpl_connection_name= server2 |
| 189 |
--source include/rpl_connection.inc |
| 190 |
--source include/stop_group_replication.inc |
| 191 |
|
| 192 |
--echo ############################################################################### |
| 193 |
--echo # 6. Stop GR and try to call UDFs outside of a group |
| 194 |
--let $rpl_connection_name= server1 |
| 195 |
--source include/rpl_connection.inc |
| 196 |
|
| 197 |
# Cleanup. |
| 198 |
SET SQL_LOG_BIN=0; |
| 199 |
DROP TABLE t1; |
| 200 |
SET SQL_LOG_BIN=1; |
| 201 |
|
| 202 |
--source include/group_replication_end.inc |
| 203 |
|
| 204 |
--error ER_CANT_INITIALIZE_UDF |
| 205 |
SELECT group_replication_get_communication_protocol(); |
| 206 |
|
| 207 |
--error ER_CANT_INITIALIZE_UDF |
| 208 |
SELECT group_replication_set_communication_protocol("5.7.14"); |