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
|
# ==== Purpose ====
#
# This test checks that the replica parameter ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS works when
# replicating into a Group replication group.
#
# ==== Requirements ====
#
# + TC1: **ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS** works when replicating into a group
#
# ==== Implementation ====
#
# 0. This test works with 2 servers in multi primary mode and a third server
# replicating into to the group trough async replication
#
# 1. Create the group by starting GR on server 1 and 2
# 2. Disable GTIDs on server 3
# 3. Setup a asynchronous replication connection from server 3 into the group (server 1)
# Calculate the source_uuid
# 4. Execute some transactions on server 3 and sync with server 1
# 5. Execute a transaction on the group and sync
# 6. GTID_EXECUTED on server 1 must contain the transactions from server 3.
# Validate data on server 1.
# 7. GTID_EXECUTED on server 2 must contain the transactions from server 3.
# Validate data on server 2.
# 8. Cleanup
#
# ==== References ====
#
# WL#12819:GTIDs: Replicate from GTID disabled source to GTID enabled replica directly
#
# ==== Usage ====
#
# --let $_rename_parameter = LOCAL | UUID
# --source ../include/gr_replicate_anonymous_server_to_group.inc
#
# Parameters:
# $_rename_parameter
# The ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS parameter for the server that receives the transactions
#
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source include/group_replication.inc
--echo
--echo ############################################################
--echo # 1. Setup Group Replication on server 1 and 2.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--echo
--echo ############################################################
--echo # 2. Disable GTIDs on server 3
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $rpl_gtid_mode= OFF
--let $rpl_server_numbers= 3
--source include/rpl_set_gtid_mode.inc
--echo
--echo ############################################################
--echo # 3. Setup a asynchronous replication connection from server 3
--echo # into the group (server 1)
--echo # Calculate the source_uuid
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $_source_uuid = $_rename_parameter
--let $__rename_parameter = "$_rename_parameter"
if ($_rename_parameter == 'LOCAL')
{
--let $_source_uuid = `SELECT @@SERVER_UUID`
--let $__rename_parameter = $_rename_parameter
}
--replace_result $SERVER_MYPORT_3 SERVER_3_PORT
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST="127.0.0.1", SOURCE_USER="root", SOURCE_PASSWORD="", SOURCE_PORT=$SERVER_MYPORT_3, ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS=$__rename_parameter
--source include/start_slave.inc
--echo
--echo ###################################################################
--echo # 4. Execute some transactions on server 3 and sync with server 1
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0);
INSERT INTO t1 VALUES (1);
UPDATE t1 SET c1=2 WHERE c1=0;
--let $sync_slave_connection= server1
--let $use_gtids= 0
--source include/sync_slave_sql_with_master.inc
--let $use_gtids= 1
--echo
--echo ############################################################
--echo # 5. Execute a transaction on the group and sync
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (6);
--source include/rpl_sync.inc
--echo
--echo ############################################################
--echo # 6. GTID_EXECUTED on server 1 must contain the transactions
--echo # from server 3.
--echo # Validate data on server 1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain server 4 GTID_EXECUTED from server 3 with server 1 UUID
--let $assert_cond= [SELECT GTID_SUBSET("$_source_uuid:1-4", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 2 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 6 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 6, count, 1] = 1
--source include/assert.inc
--echo
--echo ############################################################
--echo # 7. GTID_EXECUTED on server 2 must contain the transactions
--echo # from server 3.
--echo # Validate data on server 2.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain server 4 GTID_EXECUTED from server 3 with server 1 UUID
--let $assert_cond= [SELECT GTID_SUBSET("$_source_uuid:1-4", @@GLOBAL.GTID_EXECUTED)] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 1 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 2 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 6 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 6, count, 1] = 1
--source include/assert.inc
--echo
--echo ############################################################
--echo # 8. Cleanup
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
DROP TABLE t1;
--let $sync_slave_connection= server1
--let $use_gtids= 0
--source include/sync_slave_sql_with_master.inc
--let $use_gtids= 1
# Stop asynchronous replication connection from server 3
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_slave.inc
# Restore the GTID_MODE on server 3
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $rpl_gtid_mode= ON
--let $rpl_skip_sync= 1
--let $rpl_server_numbers= 3
--source include/rpl_set_gtid_mode.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
# Stop Group Replication on server 1 and 2 to avoid sync problems
--source include/stop_group_replication.inc
SET session sql_log_bin=0;
CALL mtr.add_suppression("Using ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS implies limitations on the replication topology");
SET session sql_log_bin=1;
--let $allow_rpl_inited=1
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--let $restart_parameters=restart:--group_replication_group_name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1 --group_replication_start_on_boot=OFF
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
--source include/restart_mysqld.inc
--let $rpl_server_number= 1
--source include/rpl_reconnect.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--source include/group_replication_end.inc
|