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
|
################################################################################
# This test validates the functioning of the version handshake algorithm on
# group replication.
# The test makes the group go through several changes involving different member
# versions validating the expected outcome on each case.
# The test script is:
# *) The test requires five servers: S1, S2, S3, S4
#
# Server Step Version (to base) Outcome
#-------------------------------------------------------------------------------
# (S1) join member with a higher patch version* (patch version + 1) OK
# (S2) join member with a higher minor version (minor version + 1) OK
# (S3) join member with the base version (base version) Failure
# (S3) member leaves
# (S3) join member with a higher major version (major version +1) OK
# (S4) join member with a higher minor version (minor version + 1) OK
# (S1) member leaves
# (S1) join member with the base version (base version) Failure
#
# *) The group start happens with Server 1 joining
#
# The base version is version of the plugin associated with this test:
# Version= MAJOR.MINOR.PATCH
#
################################################################################
--source include/not_valgrind.inc
--source include/big_test.inc
--source include/have_debug.inc
--let $group_replication_group_name= 8a1da670-05fa-11e5-b939-0800200c9a66
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 4
--source include/group_replication.inc
--echo #
--echo # Check the version of member 1 is fully visible in the plugin table
--echo #
--let $assert_text= The plugin major and minor versions are visible in the version column
--let $assert_cond= [SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME= "group_replication" and PLUGIN_VERSION= "1.1" ] = 1;
--source include/assert.inc
--let $assert_text= The plugin total version can be seen in the description column
--let $assert_cond= [SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME= "group_replication" and PLUGIN_DESCRIPTION= "Group Replication (1.1.0)" ] = 1;
--source include/assert.inc
--echo #
--echo # Setup a new member with version a higher patch version
--echo # Version= Base version + 1 patch version
--echo #
--connection server1
--echo server1
SET @debug_saved_s1= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_patch_version';
--source include/start_and_bootstrap_group_replication.inc
# Add some data for recovery
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--echo #
--echo # Try to add a new member with a higher minor version
--echo # Version = Base version + 1 minor version
--echo # The member will join the group
--echo #
--connection server2
--echo server2
SET @debug_saved_s2= @@GLOBAL.DEBUG;
# Cause the member to broadcast and compare himself using a higher version
SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_minor_version';
SET session sql_log_bin=0;
call mtr.add_suppression("Member version is read compatible with the group.");
SET session sql_log_bin=1;
--source include/start_group_replication.inc
# Check the data is there
--let $assert_text= On the recovered member, the table should contain 1 elements
--let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
--source include/assert.inc
--echo #
--echo # Try to add a new member with a base version.
--echo # Version = Base version
--echo # It will fail since group lowest version is (patch + 1)
--echo # Try to add server 3 again with higher major version.
--echo # Version= Base version + 1 major version
--echo # It will succeed and join group in read only mode.
--echo #
--connection server3
--echo server3
SET session sql_log_bin=0;
call mtr.add_suppression("Member version is incompatible with the group");
call mtr.add_suppression("Member version is read compatible with the group.");
SET session sql_log_bin=1;
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
# Cause the member to broadcast and compare himself using a higher version
SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_major_version';
--source include/start_group_replication.inc
# Check the data is there
--let $assert_text= On the recovered member, the table should contain 1 elements
--let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
--source include/assert.inc
--echo #
--echo # Try to add a new member with a major version equal to the base version,
--echo # but a higher minor version.
--echo # Version = Base version + 1 minor version
--echo #
--connection server4
--echo server4
SET @debug_saved_s4= @@GLOBAL.DEBUG;
SET session sql_log_bin=0;
call mtr.add_suppression("Member version is read compatible with the group.");
SET session sql_log_bin=1;
# Cause the member to broadcast and compare himself using a high version
SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_minor_version';
SET GLOBAL group_replication_group_name= "8a1da670-05fa-11e5-b939-0800200c9a66";
# Before < 8.0.16 this join used to fail because higher major version member is present i.e. S3 server
# Post 8.0.16 this will succeed, since comparison is done with only lowest version i.e. S1 in this scenario
# S4 is compatible since its greater then patch version present in group i.e. S1 server
--source include/start_group_replication.inc
# Check the data is there
--let $assert_text= On the recovered member, the table should contain 1 elements
--let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
--source include/assert.inc
--echo #
--echo # Stop GR on server 1 and start server 1 with base version.
--echo # Version = Base version
--echo # It will fail since group lowest version is (minor + 1)
--echo #
--connection server1
--echo server1
# DROP table now, else we will have to start all servers for cleanup
DROP TABLE t1;
--source include/rpl_sync.inc
--source include/stop_group_replication.inc
SET session sql_log_bin=0;
call mtr.add_suppression("Member version is incompatible with the group");
SET session sql_log_bin=1;
SET @@GLOBAL.DEBUG= @debug_save_s1;
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
--echo #
--echo # Clean up
--echo #
--connection server2
--echo server2
SET @@GLOBAL.DEBUG= @debug_save_s2;
--source include/stop_group_replication.inc
--connection server3
--echo server3
SET @@GLOBAL.DEBUG= @debug_save_s3;
--source include/stop_group_replication.inc
--connection server4
--echo server4
SET @@GLOBAL.DEBUG= @debug_save_s4;
--source include/stop_group_replication.inc
--source include/group_replication_end.inc
|