Subject Re: Generators for auto-increment - with override
Author Adam
Ann is right. Even if other threads increment the generator, you will
only have some generator values that are never used.

Calls to generators are threadsafe, which means they must use some
form of mutex locking. The only possible bottleneck I can see is the
excessive calls to the generator, but I really doubt that will become
an issue.


--- In firebird-support@yahoogroups.com, "Ann W. Harrison"
<aharrison@i...> wrote:
> Alan McDonald wrote:
> >
> > between this line
> >>>> if (new.TEST_ID > GEN_VALUE) then
> > and this line
> >>>> GEN_VALUE = gen_id(GEN_TEST_ID,new.TEST_ID - GEN_VALUE);
> >
> > the generator counld be fired by someone else and thus GEN_VALUE
would be
> > larger than expected at the third line
>
> True, but that doesn't matter in terms of database consistency.
All it
> means is that you'll lose a few more generator values. The value
> returned by gen_id in the second line is never used.
>
>
> Regards,
>
>
> Ann