🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.replication
Article #9

Re: Changing primary key and replicate this value

#9
From: Paul Beach
Date: Mon, 23 Feb 2004 17:16
27 lines
2544 bytes
> I handle this in my own replicator, but I have a completely different
> approach, which makes it easy. If you log every change, indicating
> whether it is an INSERT, an UPDATE or a DELETE, and then you replicate
> this change in the same way to the other side (if I understand
> correctly, this is how IBReplicator works), then it will be very
> difficult to handle PK changes. Suppose in DB 1, a user inserts a record
> with PK=34, and then updates it to 35 before replicating. When the
> replicator starts, it will see two changes : one insert, and one update.
> So it will try to perform the insert, but it won't succeed, since the
> record referenced by the line in the replication log corresponding to
> the insert, no longer has any corresponding record. Then, the update
> also doesn't work, obviously, since the insert didn't.

Er no. Only committed changes get replicated.
So this would really be insert PK=34 commit - Write replication insert to
replication log.
Then the insert takes place on the target with PK=34 data=blah

Now if you update the primary key, and make it 35, commit,  an update would
fail on the
target because replication expects to find the same primary key in the target
database
as the source i.e. update 35 which doesn't exist. Changing primary keys in
distributed databases (which includes replicated ones) is not the brightest
move.

Paul
Technical Details
Message-ID: <403a355b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4034dce9$1@newsgroups.borland.com> <4034e8dc$1@newsgroups.borland.com> <4035deb9$1@newsgroups.borland.com> <mcic30d6avuml13ilsuokrerfncilfpjtu@4ax.com> <403653d3@newsgroups.borland.com> <4039b863$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f89d7,2f886c55ebe3c509
X-Google-Attributes: gidf89d7,public
X-Google-ArrivalTime: 2004-02-23 09:40:32 PST
Reply-To: "Paul Beach" <pbeach@ibphoenix.com>
From: "Paul Beach" <pbeach@ibphoenix.com>
Newsgroups: borland.public.interbase.replication
References: <4034dce9$1@newsgroups.borland.com> <4034e8dc$1@newsgroups.borland.com> <4035deb9$1@newsgroups.borland.com> <mcic30d6avuml13ilsuokrerfncilfpjtu@4ax.com> <403653d3@newsgroups.borland.com> <4039b863$1@newsgroups.borland.com>
Subject: Re: Changing primary key and replicate this value
Date: Mon, 23 Feb 2004 17:16:28 -0000
Lines: 29
Organization: IBPhoenix
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 217.44.220.116
Message-ID: <403a355b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1077556571 217.44.220.116 (23 Feb 2004 09:16:11 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail