Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 367A413364DE for ; Wed, 23 Mar 2011 04:27:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 52391-05-3 for ; Wed, 23 Mar 2011 07:27:15 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from shaykin.bluegap.ch (shaykin.bluegap.ch [78.46.81.73]) by mail.postgresql.org (Postfix) with ESMTP id 5B8C31337B68 for ; Wed, 23 Mar 2011 04:27:15 -0300 (ADT) Received: from [IPv6:2001:1620:f70:16:216:e6ff:fed5:fc9] ([2001:1620:f70:16:216:e6ff:fed5:fc9]) (AUTH: LOGIN markus@bluegap.ch, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by shaykin.bluegap.ch with esmtp; Wed, 23 Mar 2011 08:27:13 +0100 id 0000000002A08009.000000004D89A0D2.000012B0 Message-ID: <4D89A0D1.4030601@bluegap.ch> Date: Wed, 23 Mar 2011 08:27:13 +0100 From: Markus Wanner User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101226 Icedove/3.0.11 MIME-Version: 1.0 To: Robert Haas CC: Aidan Van Dyk , Simon Riggs , Heikki Linnakangas , Kevin Grittner , MARK CALLAGHAN , Alvaro Herrera , Andrew Dunstan , pgsql-hackers Subject: Re: Re: [COMMITTERS] pgsql: Efficient transaction-controlled synchronous replication. References: <4D741441.2090704@dunslane.net> <1299454125.1696.6138.camel@ebony> <4D74896C.5030402@enterprisedb.com> <4D74DDFA.70800@dunslane.net> <4D74E584.7080409@enterprisedb.com> <4D74E9FA.7070202@dunslane.net> <4D74F3AE.9000802@dunslane.net> <4D74FDEC.5040406@enterprisedb.com> <4D74FF15.1070804@dunslane.net> <1299513979-sup-1987@alvh.no-ip.org> <4D832571.5030808@bluegap.ch> <1300457958.18619.13780.camel@ebony> <4D832B4D020000250003BA98@gw.wicourts.gov> <4D837EA2.2070205@enterprisedb.com> <1300465171.18619.15193.camel@ebony> <4D83B02A.5090105@bluegap.ch> <1300476590.18619.18115.camel@ebony> <4D83B54C.2030708@bluegap.ch> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.409 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FS_REPLICA=3.599, SARE_SPEC_REPLICA=0.72, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: ** X-Archive-Number: 201103/1337 X-Sequence-Number: 184587 On 03/22/2011 09:33 PM, Robert Haas wrote: > We might have a version of synchronous replication that works this way > some day, but it's not the version were shipping with 9.1. The slave > acknowledges the WAL records when they hit the disk (i.e. fsync) not > when they are applied; WAL apply can lag arbitrarily. The point is to > guarantee clients that the WAL is on disk somewhere and that it will > be replayed in the event of a failover. Despite the fact that this > doesn't work as you're describing, it's a useful feature in its own > right. In that sense, our approach may be more synchronous than most others, because after the ACK is sent from the slave, the slave still needs to apply the transaction data from WAL before it gets visible, while the master needs to wait for the ACK to arrive at its side, before making it visible there. Ideally, these two latencies (disk seek and network induced) are just about equal. But of course, there's no such guarantee. So whenever one of the two is off by an order of magnitude or two (by use case or due to a temporary overload), either the master or the slave may lag behind the other machine. What pleases me is that the guarantee from the slave is somewhat similar to Postgres-R's: with its ACK, the receiving node doesn't guarantee the transaction *is* applied locally, it just guarantees that it *will* be able to do so sometime in the future. Kind of a mind twister, though... Regards Markus