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
|
################################################################################
# WL#6833: GCS Replication: Read-set free Certification
# Module (DBSM Snapshot Isolation)
#
# Scenario 2: Replicate from a server into a group
#
# Verify Group Replication behavior when we establish a
# asynchronous replication connection from a server to a group.
#
# Test:
# 0. The test requires three servers: M1, M2 and M3.
# 1. Bootstrap start a group on M1. Start GR on M2.
# 2. Setup a asynchronous replication connection from M3 into group(M1)
# i.e. M3 -> M1.
# 3. Execute some transactions on M3.
# 4. Wait until transactions executed on M3 are applied on group.
# 5. Execute a transaction on the group(M1).
# 6. Validate data on M3.
# 8. Validate data on M1. GTID_EXECUTED on M1 must have GTID_EXECUTED from M3.
# 9. Validate data on M2. GTID_EXECUTED on M2 must have GTID_EXECUTED from M3.
# 10. Clean data.
# 11. Stop asynchronous replication connection from M3 into group(M1).
# 12. Stop Group Replication on M1 and M2.
################################################################################
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9420000
--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.
--connection server1
--source include/start_and_bootstrap_group_replication.inc
--connection server2
--source include/start_group_replication.inc
--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc
--echo
--echo ############################################################
--echo # 2. Setup a asynchronous replication connection from server 3
--echo # into group (server 1)
--connection server1
--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, SOURCE_AUTO_POSITION=1
--source include/start_slave.inc
--echo
--echo ############################################################
--echo # 3. Execute some transactions on server 3.
--connection server3
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;
SET GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1';
BEGIN;
COMMIT;
SET GTID_NEXT= 'AUTOMATIC';
--echo
--echo ############################################################
--echo # 4. Wait until transactions executed on server 3 are applied
--echo # on group.
--connection server3
--let $sync_slave_connection= server1
--source include/sync_slave_sql_with_master.inc
--connection server3
--let $sync_slave_connection= server2
--source include/sync_slave_sql_with_master.inc
--echo
--echo ############################################################
--echo # 5. Execute a transaction on the group.
--connection server1
INSERT INTO t1 VALUES (6);
--source include/rpl_sync.inc
--echo
--echo ############################################################
--echo # 6. Validate data on server 3.
--connection server3
--let $server3_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED`
--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 no value 6 in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 6, count, 1] = 0
--source include/assert.inc
--echo
--echo ############################################################
--echo # 7. GTID_EXECUTED on server 1 must contain GTID_EXECUTED
--echo # from server 3.
--echo # Validate data on server 1.
--connection server1
--let $assert_text= GTID_EXECUTED must contain server 3 GTID_EXECUTED
--let $assert_cond= [SELECT GTID_SUBSET("$server3_gtid_executed", @@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. GTID_EXECUTED on server 2 must contain GTID_EXECUTED
--echo # from server 3.
--echo # Validate data on server 2.
--connection server2
--let $assert_text= GTID_EXECUTED must contain server 3 GTID_EXECUTED
--let $assert_cond= [SELECT GTID_SUBSET("$server3_gtid_executed", @@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 # 9. Clean data.
--connection server3
DROP TABLE t1;
--let $sync_slave_connection= server1
--source include/sync_slave_sql_with_master.inc
--connection server3
--let $sync_slave_connection= server2
--source include/sync_slave_sql_with_master.inc
--echo
--echo ############################################################
--echo # 10. Stop asynchronous replication connection from server 3
--echo # into group (server 1)
--connection server1
--source include/stop_slave.inc
CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION=0 FOR CHANNEL "";
--echo
--echo ############################################################
--echo # 11. Stop Group Replication on server 1 and 2.
--connection server1
--source include/stop_group_replication.inc
--connection server2
--source include/stop_group_replication.inc
--source include/group_replication_end.inc
|