Subject Re: [ib-support] Re: Changing Insert to Update.
Author John Peterson
Hmmm....interesting idea. however.....
One of the reasons for the duplication of servers is the possibility of lost
data down the wire. When this happens, one will insert the record, where
the other won't.....the keys (based on generators) are now out of sync. So,
in this case the only way to make a key (that will match same records on
different servers) is to use values in the data. Verboten, I know, but I
see no other way.

Long and short of it is, I have a working system, based on ibReplicator,
just trying to forsee the inevitable oversights.

Getting OT here.

As always, the contributed ideas help to open the mind to other
possibilities for the next project.

John
----- Original Message -----
From: "Svein Erling Tysvær" <svein.erling.tysvaer@...>
To: <ib-support@yahoogroups.com>
Sent: Monday, February 11, 2002 7:43 PM
Subject: [ib-support] Re: Changing Insert to Update.


> Sorry John, there's one thing I don't understand: Why can't you guarantee
> that the PK is the same on both servers? I think it should be pretty
simple
> given that you know the number of servers. Just make sure that
> a) the key is only generated if not supplied explicitly.
> b) multiply the generator with the number of servers (or a higher number
if
> you want a "buffer") and add a set number to each of the servers.
>
> So, with your two servers, assign 0 as the set number for one of them and
1
> for the other. Always multiply your generated value by 2 and add the set
> number. Then one of the servers will create the records with even key
> numbers, whereas the other will make odd numbers. When transferring
records
> to the other server, remember to transfer the key as well, and you've got
> your unique key across both servers. I've never done this myself, but it
> doesn't sound very difficult to implement and it guarantees you unique
> identifiers.
>
> Just some rambling from a lazy programmer more concerned about making
> things work than coming up with fancy solutions,
> Set
>
> John Peterson wrote:
> > My Unique Constraint and the issue of non atomic key is a bit tricky,
since
> > the application is part of a replication system.
> > The data is being fed to 2 servers via 2 feeds. I have PK in each
(atomic
> > via Generator), however I cannot guarantee that for a given record, the
PK
> > will have the same value on each server (100 things could go wrong to
get
> > them out of step).
> > What I am left with is using a few columns to generate a Unique key.
> > Fortunately, users are not entering data into these, only the data feed.
> >
> > Enough of ramble.
> > Thanks again for your invaluable input
> > John
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>