Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id A8C9D632C2E for ; Mon, 19 Apr 2010 11:35:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 17114-05 for ; Mon, 19 Apr 2010 14:34:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail148168.authsmtp.net (outmail148168.authsmtp.net [62.13.148.168]) by mail.postgresql.org (Postfix) with ESMTP id 1E0076328AB for ; Mon, 19 Apr 2010 11:34:50 -0300 (ADT) Received: from mail-c187.authsmtp.com (mail-c187.authsmtp.com [62.13.128.33]) by punt6.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id o3JEYgBW051212; Mon, 19 Apr 2010 14:34:42 GMT Received: from [192.168.0.2] (88-110-156-192.dynamic.dsl.as9105.com [88.110.156.192]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2) with ESMTP id o3JEYcPN037733; Mon, 19 Apr 2010 15:34:39 +0100 (BST) Subject: Re: Re: [COMMITTERS] pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop From: Simon Riggs To: Tom Lane Cc: Robert Haas , Heikki Linnakangas , pgsql-hackers@postgresql.org In-Reply-To: <13439.1271687068@sss.pgh.pa.us> References: <20100418180608.16F067541D1@cvs.postgresql.org> <4BCC07F1.6040405@enterprisedb.com> <1271664332.8305.17430.camel@ebony> <4BCC1644.70008@enterprisedb.com> <1271667922.8305.17650.camel@ebony> <13439.1271687068@sss.pgh.pa.us> Content-Type: text/plain Date: Mon, 19 Apr 2010 15:31:29 +0100 Message-Id: <1271687489.8305.18879.camel@ebony> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit X-Server-Quench: af8782bd-4bc0-11df-ab46-001185d377ca X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZOTQEd DAteCiN5VAwpPBRK HVkIKg5MJUcNSQVJ NksachtFaQxbbElD HGQLWlREUVh7Wmd/ aAMfZQ1DY0tOQQRv VlZIS1BNEQ1vHhxP WR1kJ3AhF3tGe3l3 ZkUsWHleXgorI056 SkwGQXACNzRgdWEe BBZFJlFQdh5Kfh5E YlUrV3QKMjRJBC9q VzwTFhsSEA9kHWxv T1NFHnk1ZGMqIgIR fSs3VS0gBlQBFW0P MhorYnERAH0XO10p MVw9dVsEOl9TaEVS AltMBiARB14dDxE3 BAVWV19WGiwVSDlb AxEpJBAABjtVQkIo X-Authentic-SMTP: 61633235383639.1000:706/Kp X-AuthFastPath: 0 (Was 255) X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201004/809 X-Sequence-Number: 160921 On Mon, 2010-04-19 at 10:24 -0400, Tom Lane wrote: > Robert Haas writes: > > On Mon, Apr 19, 2010 at 5:05 AM, Simon Riggs wrote: > >> It doesn't seem to be something we should place highly on the list of > >> events we need protection from, does it? > > > Since when do we not protect against race-conditions just because > > they're low likelihood? > > Murphy's law says that the probability of any race condition happening > in the field is orders of magnitude higher than you think. This has > been proven true many times ... Choices are 1. Check RecoveryInProgress() once outside of lock, plus wild rumour of Murphy 2. Check RecoveryInProgress() before and after holding lock 3. Check RecoveryInProgress() while holding lock All of which perform better than 4. Revert patch -- Simon Riggs www.2ndQuadrant.com