| 1 |
# The purpose of test is to validate that when executing a empty transaction |
| 2 |
# with a set GTID, the transaction can fail if |
| 3 |
# 1) the before commit hook fails |
| 4 |
# 2) the transaction is ordered to rollback. |
| 5 |
|
| 6 |
--source include/have_debug.inc |
| 7 |
--source include/have_binlog_format_mixed.inc |
| 8 |
--source include/not_group_replication_plugin.inc |
| 9 |
|
| 10 |
--source include/install_replication_observers_example.inc |
| 11 |
|
| 12 |
--echo # |
| 13 |
--echo # Phase 1: The before commit hook fails. |
| 14 |
--echo # Set a GTID in an empty transaction and watch it fail |
| 15 |
--echo # |
| 16 |
|
| 17 |
SET SESSION sql_log_bin= 0; |
| 18 |
call mtr.add_suppression("Run function 'before_commit' in plugin"); |
| 19 |
SET SESSION sql_log_bin= 1; |
| 20 |
|
| 21 |
SET @debug_saved= @@GLOBAL.DEBUG; |
| 22 |
SET @@GLOBAL.DEBUG= '+d,force_error_on_before_commit_listener'; |
| 23 |
|
| 24 |
SET gtid_next='aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1'; |
| 25 |
|
| 26 |
--error ER_RUN_HOOK_ERROR |
| 27 |
COMMIT; |
| 28 |
|
| 29 |
SET @@GLOBAL.DEBUG= @debug_saved; |
| 30 |
|
| 31 |
ROLLBACK; |
| 32 |
SET gtid_next='automatic'; |
| 33 |
|
| 34 |
--echo # |
| 35 |
--echo # Phase 2: The before commit hook makes the transaction rollback |
| 36 |
--echo # Set a GTID in an empty transaction and watch it fail |
| 37 |
--echo # |
| 38 |
|
| 39 |
SET @@GLOBAL.DEBUG= '+d,force_negative_certification_outcome'; |
| 40 |
|
| 41 |
SET gtid_next='aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2'; |
| 42 |
|
| 43 |
--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT |
| 44 |
COMMIT; |
| 45 |
|
| 46 |
SET @@GLOBAL.DEBUG= @debug_saved; |
| 47 |
|
| 48 |
ROLLBACK; |
| 49 |
SET gtid_next='automatic'; |
| 50 |
|
| 51 |
--echo # |
| 52 |
--echo # Clean up |
| 53 |
--echo # |
| 54 |
|
| 55 |
--source include/uninstall_replication_observers_example.inc |