################################################################################ # WL#6833: GCS Replication: Read-set free Certification # Module (DBSM Snapshot Isolation) # # Scenario 3: Replay a binary log into a group # # Verify Group Replication behavior when we replay a binary # log to a group. # # Test: # 0. The test requires three servers: M1, M2 and M3. # 1. Execute some transactions on M3, which doesn't belong to the group. # 2. Setup Group Replication on M1 and M2. # 3. Replay M3 binary log into group (M2). # 4. Validate data on M3. # 5. GTID_EXECUTED on M1 must contain GTID_EXECUTED from M3. Validate data on M1. # 6. GTID_EXECUTED on M2 must contain GTID_EXECUTED from M3. Validate data on M2. # 7. Stop and start Group Replication on M1 to validate that recovery is working # working properly. # 8. Clean up. # 9. Stop Group Replication on M1 and M2. ################################################################################ --let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9420001 --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. Execute some transactions on server 3, which doesn't --echo # belong to the group. --connection server3 # Force empty binary log. RESET MASTER; 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'; --let $server3_datadir= `SELECT @@DATADIR` --let $server3_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) --echo --echo ############################################################ --echo # 2. 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 # 3. Replay server 3 binary log into group (server 2). --connection server2 --let $server2_connection_args= --user=root --host=127.0.0.1 --port=$SLAVE_MYPORT --exec $MYSQL_BINLOG $server3_datadir/$server3_binlog_file | $MYSQL $server2_connection_args --source include/rpl_sync.inc --echo --echo ############################################################ --echo # 4. 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 --echo --echo ############################################################ --echo # 5. 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 --echo --echo ############################################################ --echo # 6. 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 --echo --echo ############################################################ --echo # 7. Stop and start Group Replication on server 1 to --echo # validate that recovery is working properly. --connection server1 --source include/stop_group_replication.inc --connection server2 INSERT INTO t1 VALUES (9); --connection server1 --source include/start_group_replication.inc --let $assert_text= 'There is a value 9 in table t1 on server 1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 9, count, 1] = 1 --source include/assert.inc --echo --echo ############################################################ --echo # 8. Clean data. --connection server3 DROP TABLE t1; --connection server1 DROP TABLE t1; --source include/rpl_sync.inc --echo --echo ############################################################ --echo # 9. 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