From: Chris Browne <cbbrowne@acm.org>
To: pgsql-general@postgresql.org
Subject: Re: Postgresql replication
Date: Thu, 25 Aug 2005 17:48:46 -0400
Message-ID: <60irxtn0w1.fsf@dba2.int.libertyrms.com> (raw)
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 <wyu@talisys.com> writes:
> David Goodenough wrote:
>> The most obvious one that does exactly this (generic multi-master
>> replication) is Lotus Domino. It is not a relational DB, but not sufficiently
>> far off to stop the analogy.
>> Domino marks each document with a binary value which identifies the
>> server (built from a hash of the server name and the time the DB was
>> created) and a timestamp when it was last modified, and also each document
>> (record) has an ID (like OIDs). More recent versions also do this at a field
>> level to avoid conflicts and speed replication. When two servers replicate
>
> 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.
There are two pretty reasonable ways to address this:
1. Your application does not replicate balances; those are always
computed locally. Only *transactions* are relayed.
2. Balance updates take place as a special kind of "delta update"
where replication transfers around (old.balance - new.balance) instead
of either of the values.
Either of these leads to the nifty case where that bank discovers that
you have overdrawn your account, and then takes whatever actions they
deem are appropriate next.
Such as billing you $29 for each overdraft transaction.
You're hardly going to be retiring to the Bahamas on Nx$100, are you
:-).
--
select 'cbbrowne' || '@' || 'ntlug.org';
http://cbbrowne.com/info/internet.html
Rules of the Evil Overlord #211. "If my chief engineer displeases me,
he will be shot, not imprisoned in the dungeon or beyond the traps he
helped design." <http://www.eviloverlord.com/;
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: cbbrowne@acm.org
Subject: Re: Postgresql replication
In-Reply-To: <60irxtn0w1.fsf@dba2.int.libertyrms.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> <60irxtn0w1.fsf@dba2.int.libertyrms.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