Subject | Re: savepoints limit |
---|---|
Author | kaczy27 |
Post date | 2004-12-23T08:37:16Z |
>your user
> There is a limit, though I don't know what it is. It's not just
> savepoints that get accumulated to the total, but also theinternal
> savepoints used by the engine.Yes I know that.
Who can tell how many savepoints are allowed, and what is the
typical internal use?
I feel however that the problem isn't there - I would get as you
said 'Too many transactions' and I am getting records missing in the
recordset, or insert that don't make in after commit :(
The problem is that when I run step by step instruction, everything
go ok, if I run a transactions it produce different result.
>but
>
> >Can I safely read from records I inserted in current transaction
> >some levels before possible after few partial commits (savepointsSavepoints don't
> >releases)?
>
> I think you are misunderstanding the use of savepoints.
> commit anything. They simply flag points in the execution ofstatements
> within your transaction to which you can undo changes, withoutundoing
> changes that were posted prior to the savepoint. IOW, usersavepoints have
> the effect of nested transactions - atomic blocks of executionwithin the
> atomic block that is the enclosing transaction.I am using them as I would use nested transactions, ie. to
encapsulate atomic operations that consist of several statements
that operate over different tables.
That would be one level, I am facing another levels (hence the need
for nested transaction) where a bulk of atomic operations must be
conducted, and where some of them may fail (then exception,
rollback, go with another operation). Another reason is that it is a
business object layer which operate by creating transactions for
itself as the objects need loading or persisting.
I do think that it is a correct use of nested transactions.
>logic in
> So, typically, your client code will be characterised by branching
> response to exceptions that occur during the course of thetransaction:
>identifier
> if (ExceptionOccurs) then ROLLBACK TO savp1;
>
> If that's not how you're using savepoints then don't use them.
>
> You can economise on savepoints by reusing the same savepoint
> once your program logic doesn't need the savepoint any more. Bycalling
> SAVEPOINT savp1, you release the existing flag that savp1 isholding and
> reuse it to flag the current point of execution.That is not exactly what is written in doc:
"
RELEASE SAVEPOINT <identifier> [ONLY];
Use the RELEASE SAVEPOINT statement to erase savepoint <identifer>
from the transaction context. Unless you specify ONLY clause all
savepoints
established since the savepoint <identifier> are erased too.
"
The way I understand it is that you can release the savepoint to
free the resource. You can't then rollback the atomic operation
embraced by this savepoint, if you can't rollback somethign I call
it 'committed' (although I agree that this might be misguiding). In
such state you can rollback this operation only by rolling back to
earlier savepoint (ie. rolling back transaction of the higher level).
The transaction commit means that all savepoints are relased and
changes are accepted.
>be
> >I know I should not update the same record multiple times
> >within the same transaction. I am not doing this, but what could
> >the consequences, is it defined as no (if so why there is notimes, but
> >exception from Firebird) or it only bails out under some
> >circumstances (what are those if so).
>
> The engine won't stop you from hitting the same row multiple
> each "hit" on the same row increases the number of internal("Too
> savepoints. When the limit is reached, you will get an exception
> many savepoints").triggers) is
>
> Frankly, if your program logic (or your PSQL logic in SPs or
> such that your transaction *needs* to hit the same row more thanonce, then
> it's very likely your program logic needs reviewing.Thats happily not the case ( I have to store data vertically not
horizontally). and hopefully the logic has no need to be changed.
The problem remains however. I believe it is a bug. I'll try to
create reproducable case.
>thanks Helen
> ./hb
CUIN Kaczy