Jan Wieck JanWieck
Wed Aug 10 16:02:43 PDT 2005
On 8/10/2005 10:39 AM, Andrew Sullivan wrote:
> On Wed, Jul 27, 2005 at 11:13:55AM -0400, Christopher Browne wrote:
>> 
>> Yes, this indicates that there is room for someone to implement an
>> asynchronous multimaster replication system with conflict resolution.
>
> This was a long time coming as a followup, but Josh Berkus sketched
> the kernel of a way to do this using Slony for me while we were at
> OSCON.  I dunno if it'll work, but basically the idea is to expand
> the key that the trigger needs to include a serverid.  You'd need
> some management tools for this.
> 
> He told me that Sybase's answer to conflict resolution in these cases
> is that the first one in wins, period.  I don't know I'm comfortable
> with that.

First one wins? I thought last update wins is the default for that sort.

Both are insufficient for resolving conflicts on balance type columns 
(like an account balance). What would be necessary is the distinction 
between balance and overwrite type columns, plus a timestamp on all 
replicated tables (either in the table itself or a helper status table). 
If an update to a row happens, it can generate two replication 
recordings. One for the overwrite type columns, that just propagates the 
new values. The other for balance type columns, that propagates delta 
values instead. All balance type recordings are applied on all peers no 
matter what their timestamp, plus they don't affect the timestamping on 
the rows. The overwrite recordings are only applied if their timestamp 
is later than the timestamp on the row.

There are more complicated race conditions. Think of a 3 node setup. 
Node A does an INSERT. Node B replicates that and then does an UPDATE to 
that row. How do you guarantee that node C will replicate the INSERT 
before replicating the UPDATE?


Jan

-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck at Yahoo.com #


More information about the Slony1-general mailing list