Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2pFJ-0000c3-IW for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2014 21:40:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W2pFJ-0003b1-2i for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2014 21:40:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2pFI-0003au-4L for pgsql-bugs@postgresql.org; Mon, 13 Jan 2014 21:40:32 +0000 Received: from moutng.kundenserver.de ([212.227.126.171]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2pFE-0003Tb-Ou for pgsql-bugs@postgresql.org; Mon, 13 Jan 2014 21:40:31 +0000 Received: from anarazel.de (p54AF4121.dip0.t-ipconnect.de [84.175.65.33]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0LtnQD-1VK6M604zF-011EpO; Mon, 13 Jan 2014 22:40:23 +0100 Received: by anarazel.de (Postfix, from userid 1000) id 6C12A105A05; Mon, 13 Jan 2014 22:40:22 +0100 (CET) Date: Mon, 13 Jan 2014 22:40:22 +0100 From: Andres Freund To: Tom Lane Cc: Heikki Linnakangas , Sergey Konoplev , matioli.matheus@gmail.com, pgsql-bugs , Maxim Boguk , =?utf-8?B?0JzQsNC60YHQuNC8INCf0LDQvdGH0LXQvdC60L4=?= , =?utf-8?B?0KHQuNC30L7QsiDQodC10YDQs9C10Lkg0J/QsNCy0LvQvtCy0LjRhw==?= Subject: Re: Hot standby 9.2.6 -> 9.2.6 PANIC: WAL contains references to invalid pages Message-ID: <20140113214022.GD5838@awork2.anarazel.de> References: <20140106134815.GE28320@alap2.anarazel.de> <52CABF3E.2050004@vmware.com> <17450.1389644346@sss.pgh.pa.us> <20140113202600.GB14861@awork2.anarazel.de> <52D44F40.1000803@vmware.com> <20140113210245.GD14861@awork2.anarazel.de> <52D45AD7.9080406@vmware.com> <19552.1389649001@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <19552.1389649001@sss.pgh.pa.us> X-Provags-ID: V02:K0:UqLnXtsrUp5/zSuFI19X6vEfGPdEmdbaAiyuDzZ90YN XVI779u+nYpLSuYKJxe2G/AH4YK+TKqDoRINtz0wEQCmHDu12U lFEOova3dC5zgH1z3hQvZP344G+X4+notHgRNFC9M158R53p1O d8qf2GWTYqb8voNwvRZKrSPBfVhOHqdoDUKnlgRRjaboUlTOAf P0S2uhl/BxkM9BX0Qo//tqMmYZTh3u4XBELbWrnjAIw5nqEZ0U d7mzZHpzqpGLsDip/3qzVJeg4y18Tbvj06yIe/qaS7S8ESc61w lfIAJDRq8pSFHVWEwCvBQmWdJVX/v3puaOv26hRBb3PDjuSPVa SNzWriUMjjqOyjP0Cn4v8GARyNb2/n2ppZKYUQOoK 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 2014-01-13 16:36:41 -0500, Tom Lane wrote: > Heikki Linnakangas writes: > > Good point. Normally, we expect the checksum to match on all pages that > > we read during WAL replay, because full page writes will initialize any > > page that is modified to an untorn state, before it's ever read. But we > > can't rely on that in the extra read that btree_xlog_vacuum() does. > > But it's not an "extra" read. It's replicating a read that was done > on the master in the btvacuumpage() scan. AFAICS the only way to fail > on the slave and not the master is if the slave has inconsistent data, > in which case you're at hazard of failing anyway. I tried to explain which scenario I see as dangerous nearby. > >> Now, you could argue that that shouldn't be the case because we're only > >> entering that codepath once STANDBY_SNAPSHOT_READY and you might be > >> right... > > > I don't think that saves us. standbyMode can be STANDBY_SNAPSHOT_READY, > > before we reach consistency. Adding a check for reachedConsistency, > > though, ought to fix it. > > Huh? Surely we're not letting queries in until we're consistent. We don't, but STANDBY_SNAPSHOT_READY isn't the only variable controlling that. It just determines whether we'd have the necessary visibility information. The full check is: */ if (standbyState == STANDBY_SNAPSHOT_READY && !LocalHotStandbyActive && reachedConsistency && IsUnderPostmaster) { ... xlogctl->SharedHotStandbyActive = true; ... SendPostmasterSignal(PMSIGNAL_BEGIN_HOT_STANDBY); } So we need to mimick that. Greetings, Andres Freund -- 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