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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
# default value
RESET MASTER;
SET @start_global_value = @@global.gtid_mode;
SELECT @start_global_value;
SET @start_enforce_gtid_consistency= @@global.enforce_gtid_consistency;
SET @@global.enforce_gtid_consistency = ON;
#
# exists as global only
#
select @@global.gtid_mode;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.gtid_mode;
--error ER_GLOBAL_VARIABLE
set gtid_mode = @start_global_value;
--error ER_GLOBAL_VARIABLE
set @@session.gtid_mode = @start_global_value;
show global variables like 'gtid_mode';
show session variables like 'gtid_mode';
--disable_warnings
select * from performance_schema.global_variables where variable_name='gtid_mode';
select * from performance_schema.session_variables where variable_name='gtid_mode';
--enable_warnings
#
# show that it is settable and can only change at most one step at a time
#
set global gtid_mode = OFF;
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
set global gtid_mode = ON_PERMISSIVE;
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
set global gtid_mode = ON;
set global gtid_mode = OFF_PERMISSIVE;
set global gtid_mode = OFF_PERMISSIVE;
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
set global gtid_mode = ON;
set global gtid_mode = ON_PERMISSIVE;
set global gtid_mode = ON_PERMISSIVE;
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
set global gtid_mode = OFF;
set global gtid_mode = ON;
set global gtid_mode = ON;
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
set global gtid_mode = OFF;
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
set global gtid_mode = OFF_PERMISSIVE;
set global gtid_mode = ON_PERMISSIVE;
set global gtid_mode = OFF_PERMISSIVE;
set global gtid_mode = OFF;
--error ER_WRONG_VALUE_FOR_VAR
set global gtid_mode = NULL;
select @@global.gtid_mode;
set global gtid_mode = default;
select @@global.gtid_mode;
set global gtid_mode = OFF_PERMISSIVE;
set global gtid_mode = default;
select @@global.gtid_mode;
set global gtid_mode = OFF_PERMISSIVE;
set global gtid_mode = ON_PERMISSIVE;
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
set global gtid_mode = default;
select @@global.gtid_mode;
set global gtid_mode = ON;
--error ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME
set global gtid_mode = default;
select @@global.gtid_mode;
--error ER_GLOBAL_VARIABLE
set session gtid_mode = ON;
# can set ON when sql_replica_skip_counter > 0 with a warning
set global gtid_mode = on_permissive;
set global sql_replica_skip_counter = 1;
set global gtid_mode = on;
--let $assert_text= A warning will be generated stating "The value of sql_replica_skip_counter will only take effect for channels running with"
--let $warning_code= query_get_value(SHOW WARNINGS, Code, 1)
--let $expected_code= convert_error(ER_SQL_REPLICA_SKIP_COUNTER_USED_WITH_GTID_MODE_ON)
--let $assert_cond= $warning_code = $expected_code
--source include/assert.inc
# No warning for setting to 0
set global sql_replica_skip_counter = 0;
set global gtid_mode = on;
# can set everything except ON when enforce_gtid_consistency!=ON
set global gtid_mode = on_permissive;
SET @@global.enforce_gtid_consistency = OFF;
set global gtid_mode = off_permissive;
set global gtid_mode = off;
set global gtid_mode = off_permissive;
set global gtid_mode = on_permissive;
--error ER_CANT_SET_GTID_MODE
set global gtid_mode = on;
SET @@global.enforce_gtid_consistency = WARN;
set global gtid_mode = off_permissive;
set global gtid_mode = off;
set global gtid_mode = off_permissive;
set global gtid_mode = on_permissive;
--error ER_CANT_SET_GTID_MODE
set global gtid_mode = on;
#
# WL6591 Restore backup on existing GTID-aware server - make
# GTID_PURGED settable always.
# OWNED_GTIDs constraints: in-progress
# transactions' gtids must not overlap with the assigned value.
#
RESET MASTER;
--connect (con1,localhost,root,,,,)
SET @@GTID_NEXT='11111111-1111-1111-1111-111111111111:1';
BEGIN;
--connection default
--error ER_CANT_SET_GTID_PURGED_DUE_SETS_CONSTRAINTS
SET @@global.gtid_purged= '11111111-1111-1111-1111-111111111111:1-2';
# --error 0
SET @@global.gtid_purged= '11111111-1111-1111-1111-111111111111:2-2';
--error ER_CANT_SET_GTID_PURGED_DUE_SETS_CONSTRAINTS
SET @@global.gtid_purged= '+11111111-1111-1111-1111-111111111111:1-1';
# --error 0
SET @@global.gtid_purged= '+11111111-1111-1111-1111-111111111111:3-3';
SELECT @@global.gtid_purged;
--connection con1
ROLLBACK;
--connection default
# test gtid_mode changes with autocommit off
CREATE TABLE t1 (a INT);
SET AUTOCOMMIT = 0;
## Confirm that gtid_mode cannot be changed when a transaction
## is in progress and gtid_next is set to 'UUID:No'.
SET SESSION GTID_NEXT = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1';
INSERT INTO t1 VALUES (1);
# transaction in progress, gtid_mode variable cannot be changed
--error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
SET GLOBAL GTID_MODE = 'off_permissive';
COMMIT;
## Confirm that gtid_mode cannot be changed when gtid_mode is
## set to 'UUID:No'.
SET SESSION GTID_NEXT = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2';
# GTID_NEXT was set, gtid_mode variable cannot be changed
--error ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID
SET GLOBAL GTID_MODE = 'off_permissive';
COMMIT;
## Confirm that gtid_mode cannot be changed during an anonymous
## transaction.
SET GTID_NEXT = 'ANONYMOUS';
--error ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID
SET GLOBAL GTID_MODE = 'off_permissive';
COMMIT;
# Set back to default and cleanup
SET AUTOCOMMIT = 1;
SET SESSION GTID_NEXT = 'AUTOMATIC';
DROP TABLE t1;
SET GLOBAL GTID_MODE ='off_permissive';
SET GLOBAL GTID_MODE = 'off';
SET @@global.enforce_gtid_consistency = @start_enforce_gtid_consistency;
#
# See rpl_gtid_mode.test for a comprehensive test case.
#
|