New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong handling of failures of TRANSACTION START trigger [CORE5843] #6104
Comments
Modified by: @hvladassignee: Vlad Khorsun [ hvlad ] |
Commented by: @hvlad Run prepare.sql to prepare database for testing: |
Modified by: @hvladAttachment: prepare.sql [ 13260 ] |
Commented by: @hvlad Test case 1: SQL> set autoddl off; MON$TRANSACTION_ID
SQL> select rdb$set_context('USER_SESSION', 'tx_abort', 1) from rdb$database; -- flag to raise error on next tx start RDB$SET_CONTEXT
SQL> commit; MON$TRANSACTION_ID
Note, transaction 683 was aborted but still alive |
Commented by: @hvlad Test case 2: SQL> RDB$SET_CONTEXT
SQL> commit; MON$TRANSACTION_ID
SQL> execute procedure tx_autonomous; RDB$GET_CONTEXT =============================================================================== Note: transaction 692 was aborted by TRANSACTION START trigger |
Modified by: @hvladstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 4.0 Beta 1 [ 10750 ] Fix Version: 3.0.4 [ 10863 ] |
Modified by: @hvladVersion: 3.0.3 [ 10810 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: No test => Done successfully |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @hvlad
Attachments:
prepare.sql
There are two general cases when TRANSACTION START trigger is fired
1. when user start transaction, and
2. when IN AUTONOMOUS TRANSACTION statement starts new transaction.
Let look what happens if TRANSACTION START is present and raises error.
According to documentation (see README.db_triggers.txt):
- TRANSACTION START
Triggers are fired in the newly user created transaction - uncaught
exceptions are returned to the client and the transaction is rolled-back.
In the 1st case new transaction is not rolled-back currently and left active until Firebird process alive.
In the 2nd case new transaction is rolled-back but it also fires TRANSACTION ROLLBACK trigger
which is wrong. Note, in the 1st case TRANSACTION ROLLBACK trigger is not fired.
Commits: ceefd57 3ddc20a c48ebfb
The text was updated successfully, but these errors were encountered: