X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BDD76D7859 for ; Thu, 25 Aug 2005 20:00:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21565-07 for ; Thu, 25 Aug 2005 23:00:20 +0000 (GMT) Received: from mail.travelamericas.com (unknown [206.130.134.147]) by svr1.postgresql.org (Postfix) with SMTP id 8716FD786F for ; Thu, 25 Aug 2005 20:00:18 -0300 (ADT) Received: (qmail 24703 invoked from network); 25 Aug 2005 23:00:21 -0000 Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) by verkiel.travelamericas.com with SMTP; 25 Aug 2005 23:00:22 -0000 Message-ID: <430E4D85.1040306@metatrontech.com> Date: Thu, 25 Aug 2005 16:00:21 -0700 From: Chris Travers User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: William Yu Cc: pgsql-general@postgresql.org Subject: Re: Postgresql replication References: <60fyszpby5.fsf@dba2.int.libertyrms.com> <20050825114411.GA30455@bafster.chello.upc.cz> <200508251406.52090.david.goodenough@btconnect.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------090605070308090802020704" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.051 required=5 tests=[AWL=0.001, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200508/1333 X-Sequence-Number: 82741 This is a multi-part message in MIME format. --------------090605070308090802020704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------090605070308090802020704 Content-Type: text/x-vcard; charset=utf-8; name="chris.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="chris.vcf" begin:vcard fn:Chris Travers n:Travers;Chris email;internet:chris@metatrontech.com x-mozilla-html:FALSE version:2.1 end:vcard --------------090605070308090802020704--