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
|
###############################################################################
# WL#11610
# Perform some simple tests about getting/setting communication_protocol.
#
# This test uses 2 servers.
#
# Test:
# 1. Start 2 servers and add them into group replication group.
# 2. Decrease communication_protocol.
# 3. Increase communication_protocol.
# 4. Confirm invalid calls to group_replication_get_communication_protocol.
# 5. Confirm invalid calls to group_replication_set_communication_protocol.
# 6. Stop GR and try to call UDFs outside of a group.
################################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_server_count= 2
--source include/group_replication.inc
# Create table with strings to test UDF further down.
SET SQL_LOG_BIN=0;
CREATE TABLE t1 (i INT, s VARCHAR(16), PRIMARY KEY (i));
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (2, "");
INSERT INTO t1 VALUES (3, "5");
INSERT INTO t1 VALUES (4, "5.7");
INSERT INTO t1 VALUES (5, "5.7.14a");
INSERT INTO t1 VALUES (6, "5.7.13");
INSERT INTO t1 VALUES (7, "99.99.99");
SET SQL_LOG_BIN=1;
# Will be used to hide the version of the server later on.
--let $mysql_version= `SELECT SUBSTRING_INDEX(VERSION(), '-', 1)`
--echo ###############################################################################
--echo # 2. Decrease communication_protocol.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $gr_new_protocol= 5.7.14
--eval SELECT group_replication_set_communication_protocol("$gr_new_protocol")
--let $gr_protocol= `SELECT group_replication_get_communication_protocol()`
--let $assert_text= communication_protocol is supposed to be $gr_new_protocol
--let $assert_cond= "$gr_protocol" = "$gr_new_protocol"
--source include/assert.inc
--let $communication_protocol_table= query_get_value(SELECT protocol_version FROM performance_schema.replication_group_communication_information, protocol_version, 1)
--let $assert_text= protocol_version ($communication_protocol_table) should be $gr_protocol
--let $assert_cond= "$communication_protocol_table" = "$gr_protocol"
--source include/assert.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $gr_protocol= `SELECT group_replication_get_communication_protocol()`
--let $assert_text= communication_protocol is supposed to be $gr_new_protocol
--let $assert_cond= "$gr_protocol" = "$gr_new_protocol"
--source include/assert.inc
--let $communication_protocol_table= query_get_value(SELECT protocol_version FROM performance_schema.replication_group_communication_information, protocol_version, 1)
--let $assert_text= protocol_version ($communication_protocol_table) should be $gr_protocol
--let $assert_cond= "$communication_protocol_table" = "$gr_protocol"
--source include/assert.inc
--echo ###############################################################################
--echo # 3. Increase communication_protocol.
--let $gr_new_protocol= 8.0.16
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--eval SELECT group_replication_set_communication_protocol("$gr_new_protocol")
--let $gr_protocol= `SELECT group_replication_get_communication_protocol()`
--let $assert_text= communication_protocol is supposed to be $gr_new_protocol
--let $assert_cond= "$gr_protocol" = "$gr_new_protocol"
--source include/assert.inc
--let $communication_protocol_table= query_get_value(SELECT protocol_version FROM performance_schema.replication_group_communication_information, protocol_version, 1)
--let $assert_text= protocol_version ($communication_protocol_table) should be $gr_protocol
--let $assert_cond= "$communication_protocol_table" = "$gr_protocol"
--source include/assert.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $gr_protocol= `SELECT group_replication_get_communication_protocol()`
--let $assert_text= communication_protocol is supposed to be $gr_new_protocol
--let $assert_cond= "$gr_protocol" = "$gr_new_protocol"
--source include/assert.inc
--let $communication_protocol_table= query_get_value(SELECT protocol_version FROM performance_schema.replication_group_communication_information, protocol_version, 1)
--let $assert_text= protocol_version ($communication_protocol_table) should be $gr_protocol
--let $assert_cond= "$communication_protocol_table" = "$gr_protocol"
--source include/assert.inc
--echo ###############################################################################
--echo # 4. Confirm invalid calls to group_replication_get_communication_protocol
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_get_communication_protocol(1);
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_get_communication_protocol(1.1);
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_get_communication_protocol("hehe");
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_get_communication_protocol(NULL);
--echo ###############################################################################
--echo # 5. Confirm invalid calls to group_replication_set_communication_protocol
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol();
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol(NULL);
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol(1);
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol(5.7);
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol("");
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol(" ");
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol("5");
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol("5.7");
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol("5.7.14a");
# Out of [5.7.14, this-mysql-version] domain
# We are using 99.99.99 as a placeholder for a version > than this-mysql-version
--replace_result $mysql_version MYSQL_VERSION
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol("5.7.13");
--replace_result $mysql_version MYSQL_VERSION
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol("99.99.99");
# With dynamic arguments, the error returned is ER_GRP_RPL_UDF_ERROR
# NULL
--error ER_GRP_RPL_UDF_ERROR
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=1;
# Empty
--error ER_GRP_RPL_UDF_ERROR
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=2;
# 5
--error ER_GRP_RPL_UDF_ERROR
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=3;
# 5.7
--error ER_GRP_RPL_UDF_ERROR
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=4;
#5.7.14a
--error ER_GRP_RPL_UDF_ERROR
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=5;
#5.7.13
--replace_result $mysql_version MYSQL_VERSION
--error ER_GRP_RPL_UDF_ERROR
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=6;
#99.99.99
--replace_result $mysql_version MYSQL_VERSION
--error ER_GRP_RPL_UDF_ERROR
SELECT group_replication_set_communication_protocol(s) FROM test.t1 WHERE i=7;
# Stop GR on server2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--echo ###############################################################################
--echo # 6. Stop GR and try to call UDFs outside of a group
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
# Cleanup.
SET SQL_LOG_BIN=0;
DROP TABLE t1;
SET SQL_LOG_BIN=1;
--source include/group_replication_end.inc
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_get_communication_protocol();
--error ER_CANT_INITIALIZE_UDF
SELECT group_replication_set_communication_protocol("5.7.14");
|