Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 1C3456328AB for ; Mon, 19 Apr 2010 11:51:14 -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 19885-01 for ; Mon, 19 Apr 2010 14:51:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail148154.authsmtp.co.uk (outmail148154.authsmtp.co.uk [62.13.148.154]) by mail.postgresql.org (Postfix) with ESMTP id C9CBB6322DD for ; Mon, 19 Apr 2010 11:51:02 -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 o3JEobZt074347; Mon, 19 Apr 2010 14:50:37 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 o3JEoZ74049147; Mon, 19 Apr 2010 15:50:35 +0100 (BST) Subject: Re: Re: [COMMITTERS] pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop From: Simon Riggs To: Heikki Linnakangas Cc: Tom Lane , Robert Haas , pgsql-hackers@postgresql.org In-Reply-To: <4BCC6C37.9090703@enterprisedb.com> 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> <1271687489.8305.18879.camel@ebony> <4BCC6C37.9090703@enterprisedb.com> Content-Type: text/plain Date: Mon, 19 Apr 2010 15:47:25 +0100 Message-Id: <1271688445.8305.18966.camel@ebony> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit X-Server-Quench: e9851e6f-4bc2-11df-ab46-001185d377ca X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZOTQEd DAteCiN5VAwpPBRK HVkIKg5MJUcNSQVJ NksachtFaQxbbElD HGQLWlREUVh7XGN/ aA8fZQ1DY0tOQQRv VlZIS1BNEQ1vHhxP WR1kJ0YYcAFGfHdx YUEsWXRcXgovfE54 QxtSQ3ACNzRidWEe 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/811 X-Sequence-Number: 160923 On Mon, 2010-04-19 at 17:44 +0300, Heikki Linnakangas wrote: > > 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 > > 4. Check RecoveryInProgress() once outside of lock, and scan the > ProcArray anyway, just in case. That's what we did before this patch. > Document that takenDuringRecovery == true means that the snapshot was > most likely taken during recovery, but there is some race conditions > where takenDuringRecovery is true even though the snapshot was taken > just after recovery finished. AFAICS all of the other current uses of > takenDuringRecovery work fine with that. Checking RecoveryInProgress() is much cheaper than scanning the whole ProcArray, so (4) is definitely worse than 1-3. -- Simon Riggs www.2ndQuadrant.com