config root man

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
Upload File :
Current File : //usr/opt/mysql57/mysql-test/suite/group_replication/t/gr_reset_master.test

################################################################################
# This test intends to prove that members can survive reset master commands.
# These commands end up causing the members to purge their relay logs
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. On M1, test a reset master command before start GR. It MUST be successful.
# 2. Bootstrap start a group on M1. Start GR on M2.
# 3. Create a table and insert some data.
# 4. Validate both members must have the same GTID set.
# 5. Stop GR and reset master on both members.
# 6. Restart both members (Bootstrap start a group on M2. Start GR on M1).
# 7. Insert some data to test that the group is still running.
# 8. Run RESET MASTER while GR is running. It must fail.
# 9. Clean up.
################################################################################
--source ../inc/have_group_replication_gtid_assignment_block_size_1.inc
--let $group_replication_group_name= c90c3c80-fde4-11e3-a3ac-0800200c9a66
--source ../inc/have_group_replication_plugin.inc

--let $rpl_skip_group_replication_start= 1
--source ../inc/group_replication.inc

--connection server1
--echo #Test a reset command before start.
RESET MASTER;

--source ../inc/start_and_bootstrap_group_replication.inc

--connection server2
--source include/start_group_replication.inc

--echo #Create a table and insert some data
--connection server1
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;

--let $sync_slave_connection= server2
--source include/sync_slave_sql_with_master.inc

--connection server2
INSERT INTO t1 VALUES (1);

--connection server1
INSERT INTO t1 VALUES (2);

--let $sync_slave_connection=server2
--source include/sync_slave_sql_with_master.inc

--connection server2
INSERT INTO t1 VALUES (3);

--let $sync_slave_connection=server1
--source include/sync_slave_sql_with_master.inc

--echo #Both members must have the same GTID set
--let $server_count=2
while ($server_count)
{
  --connection server$server_count
  --let $assert_text= On member $server_count, all executed GTID should belong to the group
  --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "c90c3c80-fde4-11e3-a3ac-0800200c9a66:1-6";
  --source include/assert.inc
  --dec $server_count
}

--echo #Stop and reset both members

--connection server1
--source include/stop_group_replication.inc
RESET MASTER;

--connection server2
--source include/stop_group_replication.inc
RESET MASTER;

--echo #Restart both members

--source ../inc/start_and_bootstrap_group_replication.inc

--connection server1

--source include/start_group_replication.inc

--echo #Both members must have an empty gtid set
--let $server_count=2
while ($server_count)
{
  --connection server$server_count
  --let $assert_text= On member $server_count, there should only 2 transactions from view changes
  --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "c90c3c80-fde4-11e3-a3ac-0800200c9a66:1-2";
  --source include/assert.inc
  --dec $server_count
}

--echo #Insert some data to test that the group is still running

INSERT INTO t1 VALUES (4);
--let $sync_slave_connection=server2
--source include/sync_slave_sql_with_master.inc

INSERT INTO t1 VALUES (5);
--let $sync_slave_connection=server1
--source include/sync_slave_sql_with_master.inc

--let $server_count=2
while ($server_count)
{
  --connection server$server_count
  --let $assert_text= On member $server_count, the table should exist and have 5 elements
  --let $assert_cond= [select count(*) from t1] = 5;
  --source include/assert.inc
  --dec $server_count
}

--echo # Run RESET MASTER while Group Replication is running must fail
--error ER_CANT_RESET_MASTER
RESET MASTER;

--echo # Clean up
DROP TABLE t1;
--source ../inc/group_replication_end.inc

Man Man