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
|
################################################################################
## Server_uuid should not match with group_replication_group_name when GR is
## running.
##
## This test case covers testing of server_uuid matching
## group_replication_group_name when server start_on_boot=OFF.
##
## Test:
## 0. This test requires 2 members.
## 0.1. Store members uuids and set bin logs for required servers.
## 1. Bootstrap server1 with server1_uuid as group_name
## 1.1. START GROUP_REPLICATION should fail on server1.
## Since server_uuid matches group_name GR should not start.
## 1.2. Validate failure logged in error file.
## 2. Bootstrap server1 with group_name as server2_UUID.
## Environment setup required to match server2_UUID and group_name.
## Server1 will work as seed.
## 2.1. Assert GR starts on server1.
## Since server_uuid does not match group_name GR should start.
## 2.2. Start server2 with server2_uuid as group_name
## 2.3. START GROUP_REPLICATION should fail on server2.
## Since server_uuid matches group_name GR should not start.
## 2.4. Validate failure logged in error file.
## 3. Bootstrap server1 with unique group_name
## 3.1. Start server2 with unique group_name
## 3.2. Assert GR starts on server2.
## Since server_uuid does not match group_name GR should start.
## 4. Cleanup
################################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
## 0.1. Store members uuids and set bin logs for required servers.
## Get server_uuid of server1
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
set session sql_log_bin=0;
call mtr.add_suppression("Member server_uuid is incompatible with the group.*");
set session sql_log_bin=1;
## Get server_uuid of server2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
set session sql_log_bin=0;
call mtr.add_suppression("Member server_uuid is incompatible with the group.*");
set session sql_log_bin=1;
--echo
--echo #######################
--echo ## BOOTSTRAP CASES ##
--echo #######################
--echo
## 1. Bootstrap server1 with server1_uuid as group_name
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @debug_group_replication_start_on_boot= @@GLOBAL.group_replication_start_on_boot;
--disable_query_log
--eval SET GLOBAL group_replication_group_name = "$member1_uuid"
--eval SET GLOBAL group_replication_start_on_boot = ON;
--enable_query_log
## 1.1. START GROUP_REPLICATION should fail on server1.
## Since server_uuid matches group_name GR should not start.
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
## 1.2. Validate failure logged in error file.
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_server_uuid_matches_group_name.1.err
--let $assert_text = Found the expected error about server_uuid incompatible with the group_name
--let $assert_select = Member server_uuid is incompatible with the group
--let $assert_count = 1
--source include/assert_grep.inc
--echo
--echo ###########################
--echo ## NON-BOOTSTRAP CASES ##
--echo ###########################
--echo
## 2. Bootstrap server1 with group_name as server2_UUID.
## Environment setup required to match server2_UUID and group_name.
## Server1 will work as seed.
--let $group_replication_group_name= $member2_uuid
--source include/start_and_bootstrap_group_replication.inc
## 2.1. Assert GR starts on server1.
## Since server_uuid does not match group_name GR should start.
--let $assert_text= 'Assert server1 is ONLINE'
--let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"ONLINE\"]" = 1
--source include/assert.inc
## 2.2. Start server2 with server2_uuid as group_name
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--disable_query_log
--eval SET GLOBAL group_replication_group_name = "$member2_uuid";
--eval SET GLOBAL group_replication_start_on_boot = OFF;
--enable_query_log
## 2.3. START GROUP_REPLICATION should fail on server2.
## Since server_uuid matches group_name GR should not start.
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
## 2.4. Validate failure logged in error file.
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_server_uuid_matches_group_name.2.err
--let $assert_text = Found the expected error about server_uuid incompatible with the group_name
--let $assert_select = Member server_uuid is incompatible with the group
--let $assert_count = 1
--source include/assert_grep.inc
--echo
--echo ########################
--echo ## SUCCESSFUL CASES ##
--echo ########################
--echo
## 3. Bootstrap server1 with unique group_name
## Reset configurations and start server1
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
SET @@GLOBAL.group_replication_start_on_boot= @debug_group_replication_start_on_boot;
--let $group_replication_group_name= 8a94f357-aaaa-11aa-22bb-c80aa9420000
--source include/start_and_bootstrap_group_replication.inc
## 3.1. Start server2 with unique group_name
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
## 3.2. Assert GR starts on server2.
## Since server_uuid does not match group_name GR should start.
--let $assert_text= 'Assert server 1 and server 2 are ONLINE'
--let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"ONLINE\"]" = 2
--source include/assert.inc
--echo
--echo ###############
--echo ## Cleanup ##
--echo ###############
--echo
## 4. Cleanup
--source include/group_replication_end.inc
|