Article View: borland.public.interbase.replication
Article #8Re: Changing primary key and replicate this value
From: Jonathan Neve
Date: Mon, 23 Feb 2004 08:22
Date: Mon, 23 Feb 2004 08:22
24 lines
2342 bytes
2342 bytes
David Domingo a οΏ½crit : > The only one change in current version of IBRepl is in UPDATE: > > update TABLE set PRIMARYKEY=NEWKEYVALUES,..... where > PRIMARYKEY=OLDKEYVALUES > From my own experience, I would say that it would be much more complex than that to make IBReplicator handle changing PK values. 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. Jonathan Neve.
Technical Details
Message-ID:
<4039b863$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4034dce9$1@newsgroups.borland.com> <4034e8dc$1@newsgroups.borland.com> <4035deb9$1@newsgroups.borland.com> <mcic30d6avuml13ilsuokrerfncilfpjtu@4ax.com> <403653d3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f89d7,2f886c55ebe3c509 X-Google-Attributes: gidf89d7,public X-Google-ArrivalTime: 2004-02-23 00:34:01 PST Date: Mon, 23 Feb 2004 09:22:30 +0100 From: Jonathan Neve <jonathan@!nospam!microtec.fr> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.3.1) Gecko/20030425 X-Accept-Language: fr, en MIME-Version: 1.0 Newsgroups: borland.public.interbase.replication Subject: Re: Changing primary key and replicate this value References: <4034dce9$1@newsgroups.borland.com> <4034e8dc$1@newsgroups.borland.com> <4035deb9$1@newsgroups.borland.com> <mcic30d6avuml13ilsuokrerfncilfpjtu@4ax.com> <403653d3@newsgroups.borland.com> In-Reply-To: <403653d3@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 213.11.22.149 Message-ID: <4039b863$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077524579 213.11.22.149 (23 Feb 2004 00:22:59 -0800) Lines: 25 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail