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
|
################################################################################
# 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.
################################################################################
--source include/big_test.inc
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429490
--source include/have_group_replication_plugin.inc
--source include/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 include/group_replication_end.inc
|