pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Travers <chris@metatrontech.com>
To: William Yu <wyu@talisys.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Postgresql replication
Date: Thu, 25 Aug 2005 16:00:21 -0700
Message-ID: <430E4D85.1040306@metatrontech.com> (raw)
In-Reply-To: <delc9f$30d4$1@news.hub.org>
References: <60fyszpby5.fsf@dba2.int.libertyrms.com>
	<20050825114411.GA30455@bafster.chello.upc.cz>
	<dekc2c$1pqm$1@news.hub.org>
	<200508251406.52090.david.goodenough@btconnect.com>
	<delc9f$30d4$1@news.hub.org>

William Yu wrote:

>
> This system sounds ok for documents and general data that can always 
> be revived via version control/history. But I can't see how this would 
> work for financial transactions where you're dealing with money and 
> bank accounts. Suppose I have $100 in my account. I decided to login 
> to multiple servers and wire transfer $100 to another account on every 
> server. And I hit submit exactly at the same time for every server so 
> check. Sure they can resolve the conflict afterwards in terms of 
> saying in terms of which transfer to kill off. But the fact is that my 
> other account has that N x $100 already and I've just fleeced the bank.
>
Hmmm.......

I think you should realize by now that no multimaster async replication 
solution is going to adequately work for something like these financial 
transactions.  You need either synchronous or single-master simply 
because you need to have a concept that there is a *single* 
authoritative source of the current status and balance on the account.  
You can't really expect async-replicated servers to know about 
transactions that haven't been replicated yet can you?

In other words this problem is inherent to multimaster async 
replication.  There is no way around it.  If there was it would either 
not be async or not be multimaster :-)

I have built my own async multimaster replication systems for some 
applications.  One of them is actually a system where you have two and 
only two masters which replicate back and forth.  The trick I used here 
was for each master to use a different SERIAL field as its primary key 
so there are no duplicates.  Another option is to have a compound 
primary key which is a serial and a server-hash (this would scale to a 
larger number of masters).

Best Wishes,
Chris Travers
Metatron Technology Consulting

Attachments:

chris.vcf (text/x-vcard, 125B) download begin:vcard fn:Chris Travers n:Travers;Chris email;internet:chris@metatrontech.com x-mozilla-html:FALSE version:2.1 end:vcard

view thread (91+ messages)  latest in thread

Message-ID: <430E4D85.1040306@metatrontech.com>
Permalink:  ../430E4D85.1040306@metatrontech.com/
Also on:    postgresql.org/message-id/430E4D85.1040306@metatrontech.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: chris@metatrontech.com, wyu@talisys.com
  Subject: Re: Postgresql replication
  In-Reply-To: <430E4D85.1040306@metatrontech.com>
  References: <60fyszpby5.fsf@dba2.int.libertyrms.com> <20050825114411.GA30455@bafster.chello.upc.cz> <dekc2c$1pqm$1@news.hub.org> <200508251406.52090.david.goodenough@btconnect.com> <delc9f$30d4$1@news.hub.org> <430E4D85.1040306@metatrontech.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox