| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# When binlog is enabled, verify that a transaction with a specified |
| 4 |
# UUID:NUMBER can be committed successfully right after committing a |
| 5 |
# single statement 'CREATE TEMPORARY TABLE' transaction which raises |
| 6 |
# a GTID-violation flag and starts a transaction. |
| 7 |
# |
| 8 |
# ==== Implementation ==== |
| 9 |
# |
| 10 |
# 1) Set @@GLOBAL.GTID_MODE to OFF_PERMISSIVE and disable autocommit |
| 11 |
# 2) Create a temporary TABLE with SELECT to raise the GTID-violation flag |
| 12 |
# and start a transaction. |
| 13 |
# 3) Set GTID_NEXT='UUID:NUMBER' to cause an error |
| 14 |
# 'ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION' |
| 15 |
# 4) Commit the single statement transaction |
| 16 |
# |
| 17 |
# 5) Create a temporary TABLE to raise the GTID-violation flag |
| 18 |
# and start a transaction. |
| 19 |
# 6) Set GTID_NEXT='UUID:NUMBER' to cause an error |
| 20 |
# 'ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION' |
| 21 |
# 7) Commit the single statement transaction |
| 22 |
# |
| 23 |
# 8) Create a temporary TABLE LIKE other one to raise the GTID-violation flag |
| 24 |
# and start a transaction. |
| 25 |
# 9) Set GTID_NEXT='UUID:NUMBER' to cause an error |
| 26 |
# 'ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION' |
| 27 |
# 10) Commit the single statement transaction |
| 28 |
# |
| 29 |
# 11) Succeed to set GTID_NEXT='UUID:NUMBER' |
| 30 |
# 12) The next transaction can be committed successfully |
| 31 |
# with the specified UUID:NUMBER. |
| 32 |
# |
| 33 |
# 13) Drop a temporary TABLE to start a transaction. |
| 34 |
# 14) Set GTID_NEXT='UUID:NUMBER' to cause an error |
| 35 |
# 'ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION' |
| 36 |
# |
| 37 |
# ==== References ==== |
| 38 |
# |
| 39 |
# Bug #20748502 ASSERTION `THD->VARIABLES.GTID_NEXT.TYPE== ANONYMOUS_GROUP' FAILED. |
| 40 |
# mysql-test/t/no_binlog_gtid_next_temporary_table.test |
| 41 |
|
| 42 |
--source include/have_log_bin.inc |
| 43 |
--source include/have_binlog_format_row.inc |
| 44 |
|
| 45 |
# Clean gtid_executed so that test can execute after other tests |
| 46 |
RESET MASTER; |
| 47 |
CREATE TABLE t1 (c1 INT); |
| 48 |
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE; |
| 49 |
SET SESSION autocommit = 0; |
| 50 |
CREATE TEMPORARY TABLE Temp1 SELECT RAND(); |
| 51 |
--error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION |
| 52 |
SET SESSION GTID_NEXT = '11111111-AAAA-2222-BBBB-000000000000:1'; |
| 53 |
COMMIT; |
| 54 |
|
| 55 |
CREATE TEMPORARY TABLE Temp2(c1 INT); |
| 56 |
--error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION |
| 57 |
SET SESSION GTID_NEXT = '11111111-AAAA-2222-BBBB-000000000000:2'; |
| 58 |
COMMIT; |
| 59 |
|
| 60 |
CREATE TEMPORARY TABLE Temp3 LIKE Temp2; |
| 61 |
--error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION |
| 62 |
SET SESSION GTID_NEXT = '11111111-AAAA-2222-BBBB-000000000000:3'; |
| 63 |
COMMIT; |
| 64 |
|
| 65 |
# The transaction can be committed successfully |
| 66 |
# with the specified UUID:NUMBER. |
| 67 |
SET SESSION GTID_NEXT = '11111111-AAAA-2222-BBBB-000000000000:4'; |
| 68 |
DROP TABLE t1; |
| 69 |
|
| 70 |
SET SESSION GTID_NEXT = 'automatic'; |
| 71 |
DROP TEMPORARY TABLE Temp1,Temp2,Temp3; |
| 72 |
--error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION |
| 73 |
SET SESSION GTID_NEXT='11111111-AAAA-2222-BBBB-000000000000:5'; |
| 74 |
COMMIT; |
| 75 |
|
| 76 |
# Reset |
| 77 |
SET SESSION autocommit = 1; |
| 78 |
SET @@GLOBAL.GTID_MODE = OFF; |