Subject | Re: Maintaining proper generator values |
---|---|
Author | Alexander V.Nevsky |
Post date | 2003-11-11T20:01:54Z |
--- In firebird-support@yahoogroups.com, Doug Chamberlin
<yahoogroups@a...> wrote:
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.
situation when generators values remained behind values in the tables.
Your source database was corrupted before backup. Such a corruption
can occur on power failure etc - note Forced Writes don't affect
generators pages and they could be cached when failure happened.
And about client-side or server-side PK columns filling - guys,
what about feature request #840210 in FB RFE tracker? ;)))
Best regards,
Alexander.
<yahoogroups@a...> wrote:
> At 11/11/2003 11:53 AM (Tuesday), Wilson, Fred wrote:completely
> >Again, this isn't multi-user safe.
>
> Not completely but, then again, nothing involving generators is
> multi-user safe since they exist outside transaction control.Doug, you surprize me. Generators are multy-users safe namely
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.
> >If one is getting duplicate generated values, I would suggest thatthere's a
> >problem, and further would suggest finding and fixing the problemYes!
> And if you backup and restore the database without restoring thegenerator
> values how will you reset them? That is the situation which promptedme to
> implement my process of having the application check the currentvalues
> each time they run.Doug, you was'nt affected by backup and restore if you encountered
situation when generators values remained behind values in the tables.
Your source database was corrupted before backup. Such a corruption
can occur on power failure etc - note Forced Writes don't affect
generators pages and they could be cached when failure happened.
And about client-side or server-side PK columns filling - guys,
what about feature request #840210 in FB RFE tracker? ;)))
Best regards,
Alexander.