Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E1E73634448 for ; Thu, 1 Oct 2009 11:04:23 -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 88128-10 for ; Thu, 1 Oct 2009 14:04:15 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail128141.authsmtp.com (outmail128141.authsmtp.com [62.13.128.141]) by mail.postgresql.org (Postfix) with ESMTP id 9B702633C73 for ; Thu, 1 Oct 2009 11:04:15 -0300 (ADT) Received: from mail-c193.authsmtp.com (mail-c193.authsmtp.com [62.13.128.118]) by punt8.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n91E4AsG013406; Thu, 1 Oct 2009 15:04:10 +0100 (BST) Received: from [192.168.0.5] (88-110-190-77.dynamic.dsl.as9105.com [88.110.190.77]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n91E46J2077255; Thu, 1 Oct 2009 15:04:07 +0100 (BST) Subject: Re: Hot Standby on git From: Simon Riggs To: Heikki Linnakangas Cc: pgsql-hackers In-Reply-To: <4AC37D2D.9060400@enterprisedb.com> References: <1253958559.4449.833.camel@ebony.2ndQuadrant> <4AC37D2D.9060400@enterprisedb.com> Content-Type: text/plain Date: Thu, 01 Oct 2009 15:07:40 +0100 Message-Id: <1254406060.17864.219.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 48d40bd0-ae93-11de-90cd-002264978518 X-Report-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZOTQEd DAteCiN5VAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaARbYlpF HGQLW11EUVh7WWd/ aw0fZQ1DY0tOQQRj UFZORU1QEQdtHhxP WBcfJx10DQdGf3ly YEMsWndSWAp+fRJ5 QhwAFXBXMG5jdWEe BBVFfgMHJB5Kfh1H bFR2U3sIYG1JBC9q VzwTFhsSEA9kHWx1 RR1FFk4bR0oBD3Y7 QVgNHClH X-Authentic-SMTP: 61633235383639.1014:706/Kp X-Virus-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=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200910/34 X-Sequence-Number: 146846 On Wed, 2009-09-30 at 18:45 +0300, Heikki Linnakangas wrote: > Regarding this in InitStandbyDelayTimers: > + /* > + * If replication delay is enormously huge, just treat that as > + * zero and work up from there. This prevents us from acting > + * foolishly when replaying old log files. > + */ > + if (*currentDelay_ms < 0) > + *currentDelay_ms = 0; > + > > So we're treating restoring from an old backup the same as an up-to-date > standby server. If you're restoring from say a month old base backup > with WAL archive up to present day, and have max_standby_delay set to > say 5 seconds, the server will wait for that 5 seconds on each > conflicting query before killing it. Until it reaches the point in the > archive where the delay is less than INT_MAX/1000 seconds old: at that > point it switches into "oh my goodness, we've fallen badly behind, let's > try to catch up ASAP and kill any queries that get into the way" mode. > That's pretty surprising behavior, and not documented either. I propose > we simply remove the above check (fixing the rest of the code so that > you don't hit integer overflows), and always respect max_standby_delay. Agreed. I will docuemnt the recommendation to set max_standby_delay = 0 if performing an archive recovery (and explain why). > BTW, I wonder if should warn or something if we find that the timestamps > in the archive are in the future? IOW, if either the master's or the > standby's clock is not set correctly. Something similar was just spotted by a client. You can set a recovery_target_timestamp that is before the pg_stop_recovery() timestamp and it doesn't complain. Will fix. Not sure if I like the sound of a system moaning at me about the clock settings. Perhaps just once when it starts, when we read control file. -- Simon Riggs www.2ndQuadrant.com