All,

  I have a questions about error handling after TRANSACTION START trigger and
I want to clear my doubts or fix the bug (if confirmed).

  From 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.

  There are two places in code when TRIGGER_TRANS_START is fired:
1. jrd.cpp\start_transaction(), and
2. StmtNodes.cpp\InAutonomousTransactionNode::execute()

  The first case looks wrong - it just pass exception to the client and 
nullifies
client's transaction handle. It is nor rolled back transaction, nor allows to do
it at client side (transaction handle is lost).

  I think in this case transaction should be rolled back (in catch block).


  The second case also have no immediate error handler and let error to be
handled later by EXE (execution engine). It should pass control flow to the
branch (in the same routine) where request->req_operation == req_unwind and
it run TRANSACTION ROLLBACK trigger and only then rollback the transaction.
This is correct if error happens when some statement is executed in given
autonomous transaction. But i doubt we should run TRANSACTION ROLLBACK trigger
if TRANSACTION START trigger failed.

  In this case i think we should work as above - put TRIGGER_TRANS_START into
try block, rollback transaction at catch block, restore state as it was before
transaction start and re-throw exception.

  Another question is how to handle rollback error. I mean rollback that run
at catch block. I offer to ignore rollback error (maybe log it into 
firebird.log,
if database is not bug-checked) - we can do nothing with it anyway.

  Opinions ?

Regards,
Vlad

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to