Subject | Re: [firebird-support] Re: Maintaining proper generator values |
---|---|
Author | Doug Chamberlin |
Post date | 2003-11-11T20:39:52Z |
At 11/11/2003 03:01 PM (Tuesday), Alexander V.Nevsky wrote:
reset a generator to less than it was already set to. So your final step
above, which created the problem in your scenario, would never be done.
What I do is check if the current generator value is less than the highest
value already used. If so it is a guaranteed problem, so resetting it
upward so it is above the existing values in the database is always the
right thing to do.
> Doug, you surprize me. Generators are multy-users safe namelyThe problem here is that you have misrepresented my approach. I would NEVER
>because they are outside transaction control. Look (your approach)
>
>App 1 starts
>App 1 re-set generators - OK, it is lonely
>App 1 makes insert and move generator but don't commit yet
>App 2 starts
>App 2 select max which is less than generator value because insert
>is'nt commited
>App 2 set generator backwards
>
>next insert will fail. If you don't touch generators and let them live
>their life outside of transactions, it can fail on corrupted database
>only.
reset a generator to less than it was already set to. So your final step
above, which created the problem in your scenario, would never be done.
What I do is check if the current generator value is less than the highest
value already used. If so it is a guaranteed problem, so resetting it
upward so it is above the existing values in the database is always the
right thing to do.