| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# The purpose of this test is to ensure that the server properly restores a |
| 4 |
# previous state or preserves a new state, for GTID consistency violation, |
| 5 |
# whenever a statement execution succeeds or fails. |
| 6 |
# |
| 7 |
# ==== Requirements ==== |
| 8 |
# |
| 9 |
# R1. If a statement fails to execute successfully, the overall state observed |
| 10 |
# prior to the statement execution must be kept after the failure. |
| 11 |
# R2. If a statement executes successfully, the overall state observed after the |
| 12 |
# statement execution must be kept. |
| 13 |
# |
| 14 |
# ==== Implementation ==== |
| 15 |
# |
| 16 |
# -- TEST CASES -- |
| 17 |
# |
| 18 |
# TC1. Test if GTID consistency state is rolled back after failure |
| 19 |
# ---------------------------------------------------------------- |
| 20 |
# 1) Start a transaction. |
| 21 |
# 2) Try to drop a non-existent temporary table. |
| 22 |
# 3) Test if the execution state prior to the failure is restored, using |
| 23 |
# DEBUG_SYNC. |
| 24 |
# 4) Rollback the transaction. |
| 25 |
# |
| 26 |
# TC2. Test if GTID consistency state is persisted after success |
| 27 |
# -------------------------------------------------------------- |
| 28 |
# 1) Try to create a temporary table. |
| 29 |
# 2) Test if the execution state after the successful execution is persisted, |
| 30 |
# using DEBUG_SYNC. |
| 31 |
# |
| 32 |
# ==== References ==== |
| 33 |
# |
| 34 |
# BUG#27903831 [MYSQL 8.0 GA DEBUG BUILD] ASSERTION |
| 35 |
# `!THD->HAS_GTID_CONSISTENCY_VIOLATION |
| 36 |
|
| 37 |
|
| 38 |
--source include/have_debug.inc |
| 39 |
--source include/have_debug_sync.inc |
| 40 |
--source include/have_binlog_format_statement.inc |
| 41 |
--source include/no_ps_protocol.inc |
| 42 |
|
| 43 |
--echo # TC1. Test if GTID consistency state is rolled back after failure |
| 44 |
--echo # ---------------------------------------------------------------- |
| 45 |
SET DEBUG_SYNC='restore_previous_state_after_statement_failed SIGNAL failure'; |
| 46 |
# 1) Start a transaction. |
| 47 |
BEGIN; |
| 48 |
# 2) Try to create a temporary table. |
| 49 |
--error ER_BAD_TABLE_ERROR |
| 50 |
DROP TEMPORARY TABLE t1; |
| 51 |
# 3) Test if the execution state prior to the failure is restored, using |
| 52 |
# DEBUG_SYNC. |
| 53 |
SET DEBUG_SYNC='now WAIT_FOR failure'; |
| 54 |
# 4) Rollback the transaction. |
| 55 |
ROLLBACK; |
| 56 |
|
| 57 |
--echo # TC2. Test if GTID consistency state is persisted after success |
| 58 |
--echo # -------------------------------------------------------------- |
| 59 |
SET DEBUG_SYNC='persist_new_state_after_statement_succeeded SIGNAL success'; |
| 60 |
# 1) Try to create a temporary table. |
| 61 |
CREATE TEMPORARY TABLE t1 (c INT) ENGINE=InnoDB; |
| 62 |
# 2) Test if the execution state after the successful execution is persisted, |
| 63 |
# using DEBUG_SYNC. |
| 64 |
SET DEBUG_SYNC='now WAIT_FOR success'; |
| 65 |
|
| 66 |
DROP TABLE t1; |
| 67 |
SET DEBUG_SYNC='RESET'; |