Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 8B0661337B56 for ; Sat, 1 Jan 2011 12:36:17 -0400 (AST) 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 60518-03 for ; Sat, 1 Jan 2011 16:36:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail148114.authsmtp.net (outmail148114.authsmtp.net [62.13.148.114]) by mail.postgresql.org (Postfix) with ESMTP id E0B921337B50 for ; Sat, 1 Jan 2011 12:36:09 -0400 (AST) Received: from mail-c193.authsmtp.com (mail-c193.authsmtp.com [62.13.128.118]) by punt3.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id p01Ga4oA000214; Sat, 1 Jan 2011 16:36:04 GMT Received: from [192.168.0.2] ([81.5.146.37]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2) with ESMTP id p01Ga1OL038975; Sat, 1 Jan 2011 16:36:01 GMT Subject: Re: Sync Rep Design From: Simon Riggs To: Jeff Janes Cc: Stefan Kaltenbrunner , pgsql-hackers@postgresql.org In-Reply-To: References: <1293729972.1892.23804.camel@ebony> <4D1CC47E.7050207@kaltenbrunner.cc> <1293735853.1892.24886.camel@ebony> <4D1CEEAF.8050209@kaltenbrunner.cc> <1293744235.1892.26478.camel@ebony> <4D1D93F1.80602@kaltenbrunner.cc> <1293791171.1892.36233.camel@ebony> Content-Type: text/plain; charset="UTF-8" Date: Sat, 01 Jan 2011 16:35:59 +0000 Message-ID: <1293899759.1892.60040.camel@ebony> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-Server-Quench: 3853794b-15c5-11e0-97bb-002264978518 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZOTQEd DAteCiN5VAwpPBRK HVkIKg5MJUcNSQVJ NksadRtFaARbZ1hf HGQLWlVEUVt7WmV/ awsfZQRDZ1RPWwN0 U09WR1pVCwUmQRwA cU8fLWVydA1Pf3s+ ZEZgWXgVX0x/dkF0 RhxJFGhVYHphaTUf TUlfJVFJcANIfBlB Y1d3UXIFLwdSbGoL PyYYHB0LBgAXEzVT SUk3IEpabUsQHzE6 L/PZ X-Authentic-SMTP: 61633235383639.1014:706 X-AuthFastPath: 255 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201101/17 X-Sequence-Number: 177854 On Sat, 2011-01-01 at 05:13 -0800, Jeff Janes wrote: > On 12/31/10, Simon Riggs wrote: > > On Fri, 2010-12-31 at 09:27 +0100, Stefan Kaltenbrunner wrote: > > > >> Maybe it has been discussed but I still don't see way it makes any > >> sense. If I declare a standby a sync standby I better want it sync - not > >> "maybe sync". consider the case of a 1 master and two identical sync > >> standbys - one sync standby is in the same datacenter the other is in a > >> backup location say 15km away. > >> Given there is a small constant latency to the second box (even if you > >> have fast networks) the end effect is that the second standby will NEVER > >> be sync (because the local one will always be faster) and you end up > >> with an async slave that cannot be used per your business rules? > > > > Your picture above is a common misconception. I will add something to > > the docs to explain this. > > > > 1. "sync" is a guarantee about how we respond to the client when we > > commit. If we wait for more than one response that slows things down, > > makes the cluster more fragile, complicates the code and doesn't > > appreciably improve the guarantee. > > Whether it is more fragile depends on if you look at up-time fragility > or durability fragility. I think it can appreciably improve the > guarantee. Yes, agreed. That is why I proposed quorum commit earlier in 2010, as a way to improve the durability guarantee. That was bogged down by the requirement for named servers, which I see as unnecessary. > > 2. "sync" does not guarantee that the updates to the standbys are in any > > way coordinated. You can run a query on one standby and get one answer > > and at the exact same time run the same query on another standby and get > > a different answer (slightly ahead/behind). That also means that if the > > master crashes one of the servers will be ahead or behind. You can use > > pg_last_xlog_receive_location() to check which one that is. > > If at least one of the standbys is in the same smoking crater as the > primary, then pg_last_xlog_receive_location on it is unlikely to > respond. > > The guarantee goes away precisely when it is needed. Fairly obviously, I would not be advocating anything that forced you to use a server in the "same smoking crater". I can't see any guarantee that goes away precisely when it is needed. Perhaps you could explain the issue you see, because your comments seem unrelated to my point above. -- Simon Riggs http://www.2ndQuadrant.com/books/ PostgreSQL Development, 24x7 Support, Training and Services