Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tg4rd-0007BT-F4 for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Dec 2012 02:37:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tg4rc-0008Jp-AQ for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Dec 2012 02:37:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tg4rb-0008Jj-Fz for pgsql-bugs@postgresql.org; Wed, 05 Dec 2012 02:37:31 +0000 Received: from moutng.kundenserver.de ([212.227.17.9]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tg4rY-0004ki-4y for pgsql-bugs@postgresql.org; Wed, 05 Dec 2012 02:37:30 +0000 Received: from anarazel.de (p5DDC6236.dip.t-dialin.net [93.220.98.54]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0MLEbl-1TgLqJ0WET-000XqY; Wed, 05 Dec 2012 03:37:18 +0100 Received: by anarazel.de (Postfix, from userid 1000) id 58DA61C0173; Wed, 5 Dec 2012 03:37:17 +0100 (CET) Date: Wed, 5 Dec 2012 03:37:17 +0100 From: Andres Freund To: Tom Lane Cc: Jeff Janes , Heikki Linnakangas , Noah Misch , Pg Bugs Subject: Re: PITR potentially broken in 9.2 Message-ID: <20121205023717.GB8970@awork2.anarazel.de> References: <14784.1354394848@sss.pgh.pa.us> <16296.1354399004@sss.pgh.pa.us> <7787.1354482169@sss.pgh.pa.us> <20516.1354666844@sss.pgh.pa.us> <20121205021537.GB9811@awork2.anarazel.de> <22653.1354674454@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22653.1354674454@sss.pgh.pa.us> X-Provags-ID: V02:K0:2kB4mqpQ3X2+esnPF48GIbPfyDXgZmcv/gYEnCjeVSB mv6GaPkQIUWzhiPqK+p0GpwfkSpC2Z0v4oaeABkyO846U8p8B8 b+fzTq6Jn0sja2RoRCH9TbSYXF4dyjNqL3ZyIaK2Hm3hrV2M6o K98bNHF9iU/rCXLkYx+NrttXIZAnpwiAdZDBgH3Kin4YdnsN05 pIcUTo21Pnfj8r9AchOjsJEAJ+wVF79SdL4UDAkji/kTWnnARe +QF+apw3f2mUHx/6T7XSxrGWSHLjsqjVrQf6TsaaDQ+l7FhzVY tMD+X3Naezxeci8EqblZGBjp0gPL0Um8srSRKGHpWr+MwjEDzq ltsutFnEevjGdzBycNTIs0gHQ/rAKW2GG2LfEL+Tn X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2012-12-04 21:27:34 -0500, Tom Lane wrote: > Andres Freund writes: > >> But the key is, the database was not actually consistent at that > >> point, and so opening hot standby was a dangerous thing to do. > >> > >> The bug that allowed the database to open early (the original topic if > >> this email chain) was masking this secondary issue. > > > Could you check whether the attached patch fixes the behaviour? > > Yeah, I had just come to the same conclusion: the bug is not with > Heikki's fix, but with the pause logic. The comment says that it > shouldn't pause unless users can connect to un-pause, but the actual > implementation of that test is several bricks shy of a load. > > Your patch is better, but it's still missing a bet: what we need to be > sure of is not merely that we *could* have told the postmaster to start > hot standby, but that we *actually have done so*. Otherwise, it's > flow-of-control-dependent whether it works or not; we could fail if the > main loop hasn't gotten to CheckRecoveryConsistency since the conditions > became true. Looking at the code in CheckRecoveryConsistency, testing > LocalHotStandbyActive seems appropriate. Good point. My patch wasn't intended as something final, I just wanted confirmation that it achieves what Jeff wants because I at least - you possibly as well? - misunderstood him earlier. Would probably have missed the interaction above anyway ;) > I also thought it was pretty dangerous that this absolutely critical > test was not placed in recoveryPausesHere() itself, rather than relying > on the call sites to remember to do it. Absolutely aggreed. > So the upshot is that I propose a patch more like the attached. Without having run anything so far it looks good to me. Ok, night now, Andres -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs