Current Path : /usr/opt/mysql57/mysql-test/suite/group_replication/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/suite/group_replication/t/gr_recovery_single_server.test |
################################################################################ # Validate that a single member goes through recovery process, # consume existing applier relay log, even when it is the single # member of the group. # # Test: # 0. The test requires two servers. # 1. Stop SQL Threads on server2 so that all remote transactions are only queued # on relay log. Execute some transactions on server1. # 2. Wait until server2 receives and certifies the transaction. # 3. Make both members leave the group. # 4. Lock table on server2. Bootstrap start Group Replication only on server2. # Validate that Member state is RECOVERING, despite being the only group # member, since it is applying group applier relay log. Unlock tables. Wait # until server2 comes ONLINE. # 5. Assert that server1 and server2 have the same data and GTID_EXECUTED. # 6. Clean up. ################################################################################ --source include/have_debug.inc --source ../inc/have_group_replication_plugin.inc --source ../inc/group_replication.inc --echo ############################################################ --echo # 1. Stop SQL Threads on server2 so that all remote transactions --echo # are only queued on relay log. Execute some transactions on --echo # server1. --connection server1 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; --source include/rpl_sync.inc --connection server2 STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier"; --connection server1 INSERT INTO t1 VALUES (1); --echo --echo ################################################################ --echo # 2. Wait until server2 receives and certifies the transaction. --connection server2 --let $wait_condition= SELECT (Count_transactions_checked - Count_conflicts_detected) = 2 from performance_schema.replication_group_member_stats --source include/wait_condition.inc --echo --echo ############################################################ --echo # 3. Make both members leave the group. --connection server1 --source include/stop_group_replication.inc --connection server2 --source include/stop_group_replication.inc --echo --echo ############################################################ --echo # 4. Start Group Replication only on server2. Validate that --echo # Member state is RECOVERING, despite being the only group --echo # member, since it is applying group applier relay log. # Force group applier relay log to wait on a table lock so that the # next wait_for_member_state is deterministic. --connection server_2 LOCK TABLE t1 WRITE; --connection server2 --source ../inc/gr_set_bootstrap_group.inc SET @debug_save= @@GLOBAL.DEBUG; SET GLOBAL debug= 'd,group_replication_skip_read_mode'; --let $group_replication_start_member_state= RECOVERING --source include/start_group_replication.inc --source ../inc/gr_clear_bootstrap_group.inc --connection server_2 UNLOCK TABLES; --connection server2 --let $group_replication_member_state= ONLINE --source ../inc/gr_wait_for_member_state.inc SET @@GLOBAL.DEBUG= @debug_save; --echo --echo ############################################################ --echo # 5. Assert that server1 and server2 have the same data and --echo # GTID_EXECUTED. --connection server1 --let $assert_text= 'There is a value 1 in table t1 on server1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1 --source include/assert.inc --connection server2 --let $assert_text= 'There is a value 1 in table t1 on server2' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1 --source include/assert.inc --connection server2 --let $server2_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` --let $assert_text= 'server2 GTID_EXECUTED must contain the 2 transactions plus 3 view changes' --let $assert_cond= "$server2_gtid_executed" = "$group_replication_group_name:1-5" --source include/assert.inc --echo --echo ############################################################ --echo # 6. Clean up. --connection server1 --source include/start_group_replication.inc DROP TABLE t1; --source ../inc/group_replication_end.inc