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_set_gtid_mode.test

################################################################################
# Validate that is not possible to change GTID_MODE to
# others modes except ON when Group Replication is running.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. With members ONLINE. On M1, validate that it is not possible to change
#    GTID_MODE to others modes except ON when Group Replication is running.
# 2. Stop GR on M1 to make it OFFLINE. Then validate that it is possible to
#    change GTID_MODE to others modes than ON when Group Replication is not
#    running. But start group replication will fail after that.
# 3. Change GTID_MODE back to ON and Start GR on M1. Check that Group
#    Replication is working fine by creating table and adding some data into it.
# 4. Check that GTID_EXECUTED on M1 contains all transactions. Also check that
#    data is on tables.
# 5. Clean up.
################################################################################
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429490
--source ../inc/have_group_replication_plugin.inc
--source ../inc/group_replication.inc

# Keep binary logs with only GTIDs from test.
--connection server1
SET SESSION sql_log_bin= 0;
--source include/gtid_utils.inc
SET SESSION sql_log_bin= 1;
--connection server2
SET SESSION sql_log_bin= 0;
--source include/gtid_utils.inc
SET SESSION sql_log_bin= 1;

--let $expected_gtid_set= "8a94f357-aab4-11df-86ab-c80aa9429490:1-5"


--echo
--echo ############################################################
--echo # 1. Validate that it is not possible to change GTID_MODE to
--echo #    others modes except ON when Group Replication is running.
--connection server1
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
SET @@GLOBAL.GTID_MODE= OFF;

--let $assert_text= GTID_MODE must be ON
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "ON"
--source include/assert.inc


--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
SET @@GLOBAL.GTID_MODE= OFF_PERMISSIVE;

--let $assert_text= GTID_MODE must be ON
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "ON"
--source include/assert.inc


--error ER_CANT_SET_GTID_MODE
SET @@GLOBAL.GTID_MODE= ON_PERMISSIVE;

--let $assert_text= GTID_MODE must be ON
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "ON"
--source include/assert.inc


SET @@GLOBAL.GTID_MODE= ON;

--let $assert_text= GTID_MODE must be ON
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "ON"
--source include/assert.inc


--echo
--echo ############################################################
--echo # 2. Validate that it is possible to change GTID_MODE to other
--echo #    modes than ON when Group Replication is not running.
--echo #    But start group replication will fail after that.
--source include/stop_group_replication.inc

SET @@GLOBAL.GTID_MODE= ON_PERMISSIVE;

--let $assert_text= GTID_MODE must be ON_PERMISSIVE
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "ON_PERMISSIVE"
--source include/assert.inc

--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;

SET @@GLOBAL.GTID_MODE= OFF_PERMISSIVE;

--let $assert_text= GTID_MODE must be OFF_PERMISSIVE
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "OFF_PERMISSIVE"
--source include/assert.inc

--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;

SET @@GLOBAL.GTID_MODE= OFF;
--let $assert_text= GTID_MODE must be OFF
--let $assert_cond= "[SELECT @@GLOBAL.GTID_MODE]" = "OFF"
--source include/assert.inc

--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;

SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Gtid mode should be ON for Group Replication");
SET SESSION sql_log_bin= 1;


--echo
--echo ############################################################
--echo # 3. Change GTID_MODE back to ON and check that Group
--echo #    Replication will work properly.
SET @@GLOBAL.GTID_MODE= OFF_PERMISSIVE;
SET @@GLOBAL.GTID_MODE= ON_PERMISSIVE;
SET @@GLOBAL.GTID_MODE= ON;

--source include/start_group_replication.inc

CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);

--source include/rpl_sync.inc


--echo
--echo ############################################################
--echo # 4. Check that GTID_EXECUTED on server 1 contains all
--echo #    transactions.
--echo #    Also check that data is on tables.
--connection server1
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, $expected_gtid_set)
--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

--connection server2
--let $assert_text= GTID_EXECUTED must contain all committed GTIDs
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, $expected_gtid_set)
--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


--echo
--echo ############################################################
--echo # 5. Clean up.
DROP TABLE t1;

--connection server1
SET SESSION sql_log_bin= 0;
--source include/gtid_utils_end.inc
SET SESSION sql_log_bin= 1;
--connection server2
SET SESSION sql_log_bin= 0;
--source include/gtid_utils_end.inc
SET SESSION sql_log_bin= 1;

--source ../inc/group_replication_end.inc

Man Man