Subject RE: [firebird-support] RE: Replicator pseudo-code
Author Alexandre Benson Smith
At 09:08 22/01/2004 +1100, you wrote:

> > Have you thought about situations where the same record
> > (primary key) is
> > changed on two different systems during the same transfer
> > cycle? Perhaps
> > this can't happen in your environment, but it is something
> > that needs to
> > be considered in a general case. My approach was to create an
> > exception
> > report and ask somebody to look at it.
>
>I 'think' I have it covered.
>Each table has a dtm_rstamp TIMESTAMP, that's NOT part of the PKEY. I'm
>planning on using this for 'hinting' when PKEY collisions occur.
>Server A, record X = bill, RSTAMP = last week
>Server B, record X = henry, RSTAMP = yesterday
>
>PKEY-Matching records are sent in order of rstamp, as it's a global time
>reference. First in, first served. If a record changes the pkey info, and
>subsequent updates fail, it'll log it to a failure table.
>So record X on all servers will end up with 'henry', rstamp = yesterday.

...snip...

> > I also had to deal with the making sure my replication
> > process knew how
> > to deal with metadata changes (i.e. new fields). Again, this may not
> > apply in your situation.
>
>Thankfully, no. (Well, not yet, anyway...)
>
>Thankyou so much for your time and comments!
>
>Nige.

You could have generators values distinct and never conflicting between
databases if you use something like this:

in database a
set generator start value to 1

in database b
set generator start value to 2

in database c
set generator start value to 3
....
in database I
set generator start value to 9

then in your triggers you use
New.TableA_PK := GEN_ID(GeneratorA, 10)

this way generators
in database A will be 1, 11, 21, 31, 41, 51, etc
in database B will be 2, 12, 22, 32, 42, 52, etc
....
in database I will be 9, 19, 29, 39, 49, 59, etc

You just set this gap to the number of diferent sites (databases) you will have

A simple solution does anyone see any drawbacks ?



Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br

----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 19/01/2004


[Non-text portions of this message have been removed]