Subject | Re: [Firebird-Architect] Autonomous Transaction Routines |
---|---|
Author | Adriano dos Santos Fernandes |
Post date | 2007-11-01T17:00:52Z |
Nando Dessena escreveu:
could call a non-autonomous procedure and the second one will run inside
the same transaction of the caller.
If both are autonomous, two independent transactions should be started.
This one is more powerful and don't require ODS changes or client
changes (metadata extraction).
But if we go this way, we need to be more careful at implementation
details, for example cursors should not be allowed to be accessed in two
different transactions, I suppose.
1) not start many transactions
2) prevent deadlocks
But this is something users already should care at client application side.
Adriano
> Adriano,...
> I understand the requirements for the autonomous transaction feature.
> I am not sure why it should be linked to routines, though. Wouldn't it
> be better to allow for BEGIN TRANSACTION, COMMIT and ROLLBACK
> statements in PSQL? It will give all advantages of your idea, plus:
>
> a) ability to execute only part of a trigger or SP in an autonomous
> transaction;
>
> b) ability to execute an anonymous block in an autonomous transaction
> (admittedly not terribly useful, if not to avoid the need to process
> COMMIT and ROLLBACK on the client for simple scripts);
>
> c) ability to execute more than one SPs in the same autonomousThis point is not wrong with routines, since one autonomous routine
> transaction, without having to wrap them into a single calling SP.
>
could call a non-autonomous procedure and the second one will run inside
the same transaction of the caller.
If both are autonomous, two independent transactions should be started.
> Maybe, instead of BEGIN TRANSACTION and COMMIT/ROLLBACK (which wouldI really like your suggestion.
> also require a WHEN..DO block for rollback), a more compact syntax
> could be invented, such as:
>
> BEGIN AUTONOMOUS TRANSACTION
>
> ... code here
>
> END AUTONOMOUS TRANSACTION -- commits.
>
This one is more powerful and don't require ODS changes or client
changes (metadata extraction).
But if we go this way, we need to be more careful at implementation
details, for example cursors should not be allowed to be accessed in two
different transactions, I suppose.
> P.S. I have a fear that this is a feature very easy to misuse, but I guessYes, the user should use it with caution to:
> Firebird can't do much about that except produce good documentation
> that lists the cases in which to use autonomous transactions, and the
> cases in which it's better to avoid them.
1) not start many transactions
2) prevent deadlocks
But this is something users already should care at client application side.
Adriano