X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 52232D1B8CC for ; Wed, 27 Aug 2003 05:12:42 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 33646-10 for ; Wed, 27 Aug 2003 05:12:32 -0300 (ADT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id A49D1D1B550 for ; Wed, 27 Aug 2003 05:12:30 -0300 (ADT) Received: from lhosts ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.06.04 201-253-122-130-104-20030726) with ESMTP id <20030827081232.TLII5378.lakemtao01.cox.net@lhosts> for ; Wed, 27 Aug 2003 04:12:32 -0400 Subject: Re: Replication Ideas From: Ron Johnson To: PgSQL General ML In-Reply-To: <6358.1061955430@sss.pgh.pa.us> References: <200308270325.h7R3PfI24921@candle.pha.pa.us> <6358.1061955430@sss.pgh.pa.us> Content-Type: text/plain Message-Id: <1061971951.18060.357.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Wed, 27 Aug 2003 03:12:31 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/1527 X-Sequence-Number: 47943 On Tue, 2003-08-26 at 22:37, Tom Lane wrote: > Bruce Momjian writes: > > If you can detect if outside transactions conflict with your > > transaction, you should be able to determine if the outside transactions > > conflict with each other. > > Uh ... not necessarily. That amounts to assuming that every xact has > complete knowledge of the actions of every other, which is an assumption > I'd rather not make. Detecting that what you've done conflicts with > someone else is one thing, detecting that party B has conflicted with > party C is another league entirely. Maybe some sort of Lock Manager? A process running on each node keeps a tree structure of all locks, requested locks, what is (requested to be) locked, and the type of lock. If you are running multi-master replication, each LM keeps in sync with each other, thus creating a Distributed Lock Manager. (This would also be the key to implementing database clusters. Of course, the interface to the DLM would have to be pretty deep within Postgres itself...) Using a DLM, the postmaster on node_a would know that the postmaster on node_b has just locked a certain set of tuples and index keys, and (1) will queue up it's request to lock that data into that node's LM, (2) which will propagate it to the other nodes, (3) then when the node_a postmaster executes the COMMIT WORK, the node_b postmaster can obtain it's desired locks. (4) If the postmaster on node_[ac-z] needs to lock the that same data, it will then similarly queue up to wait until the node_b postmaster executes it's COMMIT WORK. Notes: a) this is, of course, not *sufficient* for multi-master b) yes, you need a fast, low latency network for the DLM chatter. This is a tried and true method of synchronization. DEC Rdb/VMS has been using it for 19 years as the underpinnings of it's cluster technology, and Oracle licensed it from them (well, really Compaq) for it's 9i RAC. -- ----------------------------------------------------------------- Ron Johnson, Jr. ron.l.johnson@cox.net Jefferson, LA USA "The UN couldn't break up a cookie fight in a Brownie meeting." Larry Miller