1RESET MASTER;
2SET @start_global_value = @@global.gtid_mode;
3SELECT @start_global_value;
4@start_global_value
5OFF
6SET @start_enforce_gtid_consistency= @@global.enforce_gtid_consistency;
7SET @@global.enforce_gtid_consistency = ON;
8select @@global.gtid_mode;
9@@global.gtid_mode
10OFF
11select @@session.gtid_mode;
12ERROR HY000: Variable 'gtid_mode' is a GLOBAL variable
13set gtid_mode = @start_global_value;
14ERROR HY000: Variable 'gtid_mode' is a GLOBAL variable and should be set with SET GLOBAL
15set @@session.gtid_mode = @start_global_value;
16ERROR HY000: Variable 'gtid_mode' is a GLOBAL variable and should be set with SET GLOBAL
17show global variables like 'gtid_mode';
18Variable_name	Value
19gtid_mode	OFF
20show session variables like 'gtid_mode';
21Variable_name	Value
22gtid_mode	OFF
23select * from information_schema.global_variables where variable_name='gtid_mode';
24VARIABLE_NAME	VARIABLE_VALUE
25GTID_MODE	OFF
26select * from information_schema.session_variables where variable_name='gtid_mode';
27VARIABLE_NAME	VARIABLE_VALUE
28GTID_MODE	OFF
29set global gtid_mode = OFF;
30set global gtid_mode = ON_PERMISSIVE;
31ERROR HY000: The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
32set global gtid_mode = ON;
33ERROR HY000: The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
34set global gtid_mode = OFF_PERMISSIVE;
35set global gtid_mode = OFF_PERMISSIVE;
36set global gtid_mode = ON;
37ERROR HY000: The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
38set global gtid_mode = ON_PERMISSIVE;
39set global gtid_mode = ON_PERMISSIVE;
40set global gtid_mode = OFF;
41ERROR HY000: The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
42set global gtid_mode = ON;
43set global gtid_mode = ON;
44set global gtid_mode = OFF;
45ERROR HY000: The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
46set global gtid_mode = OFF_PERMISSIVE;
47ERROR HY000: The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
48set global gtid_mode = ON_PERMISSIVE;
49set global gtid_mode = OFF_PERMISSIVE;
50set global gtid_mode = OFF;
51set global gtid_mode = NULL;
52ERROR 42000: Variable 'gtid_mode' can't be set to the value of 'NULL'
53select @@global.gtid_mode;
54@@global.gtid_mode
55OFF
56set global gtid_mode = default;
57select @@global.gtid_mode;
58@@global.gtid_mode
59OFF
60set global gtid_mode = OFF_PERMISSIVE;
61set global gtid_mode = default;
62select @@global.gtid_mode;
63@@global.gtid_mode
64OFF
65set global gtid_mode = OFF_PERMISSIVE;
66set global gtid_mode = ON_PERMISSIVE;
67set global gtid_mode = default;
68ERROR HY000: The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
69select @@global.gtid_mode;
70@@global.gtid_mode
71ON_PERMISSIVE
72set global gtid_mode = ON;
73set global gtid_mode = default;
74ERROR HY000: The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions.
75select @@global.gtid_mode;
76@@global.gtid_mode
77ON
78set session gtid_mode = ON;
79ERROR HY000: Variable 'gtid_mode' is a GLOBAL variable and should be set with SET GLOBAL
80set global gtid_mode = on_permissive;
81set global sql_slave_skip_counter = 1;
82set global gtid_mode = on;
83ERROR HY000: SET @@GLOBAL.GTID_MODE = ON is not allowed because @@GLOBAL.SQL_SLAVE_SKIP_COUNTER is greater than zero.
84set global sql_slave_skip_counter = 0;
85set global gtid_mode = on;
86set global gtid_mode = on_permissive;
87SET @@global.enforce_gtid_consistency = OFF;
88set global gtid_mode = off_permissive;
89set global gtid_mode = off;
90set global gtid_mode = off_permissive;
91set global gtid_mode = on_permissive;
92set global gtid_mode = on;
93ERROR HY000: SET @@GLOBAL.GTID_MODE = ON is not allowed because ENFORCE_GTID_CONSISTENCY is not ON.
94SET @@global.enforce_gtid_consistency = WARN;
95set global gtid_mode = off_permissive;
96set global gtid_mode = off;
97set global gtid_mode = off_permissive;
98set global gtid_mode = on_permissive;
99set global gtid_mode = on;
100ERROR HY000: SET @@GLOBAL.GTID_MODE = ON is not allowed because ENFORCE_GTID_CONSISTENCY is not ON.
101CREATE TABLE t1 (a INT);
102SET AUTOCOMMIT = 0;
103SET SESSION GTID_NEXT = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1';
104INSERT INTO t1 VALUES (1);
105SET GLOBAL GTID_MODE = 'off_permissive';
106ERROR HY000: The system variable gtid_mode cannot be set when there is an ongoing transaction.
107COMMIT;
108SET SESSION GTID_NEXT = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2';
109SET GLOBAL GTID_MODE = 'off_permissive';
110ERROR HY000: Variable gtid_mode cannot be changed by a client that owns a GTID. The client owns aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2. Ownership is released on COMMIT or ROLLBACK.
111COMMIT;
112SET GTID_NEXT = 'ANONYMOUS';
113SET GLOBAL GTID_MODE = 'off_permissive';
114ERROR HY000: Variable gtid_mode cannot be changed by a client that owns a GTID. The client owns ANONYMOUS. Ownership is released on COMMIT or ROLLBACK.
115COMMIT;
116SET AUTOCOMMIT = 1;
117SET SESSION GTID_NEXT = 'AUTOMATIC';
118DROP TABLE t1;
119SET GLOBAL GTID_MODE ='off_permissive';
120SET GLOBAL GTID_MODE = 'off';
121SET @@global.enforce_gtid_consistency = @start_enforce_gtid_consistency;
122