| 1 |
|
| 2 |
SET @start_global_value = @@session.gtid_next; |
| 3 |
SELECT @start_global_value; |
| 4 |
|
| 5 |
# |
| 6 |
# exists as session only |
| 7 |
# |
| 8 |
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 9 |
select @@global.gtid_next; |
| 10 |
select @@session.gtid_next; |
| 11 |
show global variables like 'gtid_next'; |
| 12 |
show session variables like 'gtid_next'; |
| 13 |
--disable_warnings |
| 14 |
select * from performance_schema.global_variables where variable_name='gtid_next'; |
| 15 |
select * from performance_schema.session_variables where variable_name='gtid_next'; |
| 16 |
--enable_warnings |
| 17 |
|
| 18 |
# |
| 19 |
# show that it is writable |
| 20 |
# |
| 21 |
--error ER_LOCAL_VARIABLE |
| 22 |
set global gtid_next = 1; |
| 23 |
set session gtid_next = "ANONYMOUS"; |
| 24 |
select @@session.gtid_next; |
| 25 |
|
| 26 |
# |
| 27 |
# Show that one can set it to default |
| 28 |
# |
| 29 |
ROLLBACK; |
| 30 |
set session gtid_next=default; |
| 31 |
select @@session.gtid_next; |
| 32 |
|
| 33 |
# |
| 34 |
# Show that one cannot set it to NULL |
| 35 |
# |
| 36 |
ROLLBACK; |
| 37 |
--error ER_WRONG_VALUE_FOR_VAR |
| 38 |
set session gtid_next=NULL; |
| 39 |
select @@session.gtid_next; |
| 40 |
|
| 41 |
# |
| 42 |
# Bug #20753378 ASSERTION `GTID_NEXT->TYPE != AUTOMATIC_GROUP || THD->OWNED_GTID.IS_EMPTY()' |
| 43 |
# |
| 44 |
# Setting SESSION.GTID_NEXT=default right after setting |
| 45 |
# SESSION.GTID_NEXT='ANONYMOUS' causes an error |
| 46 |
# 'ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID', but this |
| 47 |
# changed gtid_next type from 'ANONYMOUS' to 'AUTOMATIC'. |
| 48 |
# So that the next transaction causes the above assertion error. |
| 49 |
# |
| 50 |
# Setting SESSION.GTID_NEXT=default should not change the |
| 51 |
# gtid_next type if it causes an error. |
| 52 |
# |
| 53 |
# Steps to reproduce: |
| 54 |
# 1) Set @@SESSION.GTID_NEXT to ANONYMOUS. |
| 55 |
# 2) Set @@SESSION.GTID_NEXT to default to cause the |
| 56 |
# error ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID. |
| 57 |
# 3) Execute 'SELECT @@SESSION.GTID_NEXT' to verify there is no |
| 58 |
# assersion caused and gtid_next type is still ANONYMOUS. |
| 59 |
# |
| 60 |
SET @@SESSION.GTID_NEXT = 'ANONYMOUS'; |
| 61 |
--error ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID |
| 62 |
SET @@SESSION.GTID_NEXT = default; |
| 63 |
# Verify that there is no assersion caused and |
| 64 |
# gtid_next type is still ANONYMOUS. |
| 65 |
SELECT @@SESSION.GTID_NEXT; |
| 66 |
|
| 67 |
# |
| 68 |
# restore original value |
| 69 |
# |
| 70 |
ROLLBACK; |
| 71 |
set session gtid_next = @start_global_value; |
| 72 |
select @@session.gtid_next; |
| 73 |
|
| 74 |
# |
| 75 |
# See rpl_gtid_execution.test for a comprehensive test case. |
| 76 |
# |