Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2oDq-0006RH-6Y for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2014 20:34:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W2oDp-0007lK-K9 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2014 20:34:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2oDp-0007lE-0m for pgsql-bugs@postgresql.org; Mon, 13 Jan 2014 20:34:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2oDm-00028R-8I for pgsql-bugs@postgresql.org; Mon, 13 Jan 2014 20:34:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s0DKYXHQ017882; Mon, 13 Jan 2014 15:34:33 -0500 From: Tom Lane To: Andres Freund 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 In-reply-to: <20140113202600.GB14861@awork2.anarazel.de> References: <20140106134815.GE28320@alap2.anarazel.de> <52CABF3E.2050004@vmware.com> <17450.1389644346@sss.pgh.pa.us> <20140113202600.GB14861@awork2.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 13 Jan 2014 21:26:00 +0100" Date: Mon, 13 Jan 2014 15:34:33 -0500 Message-ID: <17881.1389645273@sss.pgh.pa.us> X-Pg-Spam-Score: -2.0 (--) 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 Andres Freund writes: > On 2014-01-13 15:19:06 -0500, Tom Lane wrote: >> The important point is not just that it not damage the page, but that >> it not log it as invalid. I concur that the right fix requires a >> new operating mode for XLogReadBufferExtended, perhaps RBM_NORMAL_ZERO_OK. >> I think the spec for this should be that if the page doesn't exist or >> contains zeroes, we return InvalidBuffer without logging the page number >> as invalid. The doesn't-exist case is justified by the expectation that >> there will be a later RBM_NORMAL call for a larger page number, which will >> result in a suitable complaint if the page range isn't there. > That's a sensible way to go, yes. But I wonder if we wouldn't end up > with less complicated code if we added a variant of ReadBuffer that only > returns a buffer from cache if already present in s_b. That sounds rather invasive to me, and more to the point it requires fooling with code that doesn't have anything to do with WAL replay. > I started to prototype something like RBM_NORMAL_ZERO_OK shortly after > Heikki's message and it seems to quickly turn a bit ugly because the > surrounding code isn't really ready to deal with not returning a > buffer. And for the purpose of that redo routine, that'd actually be > better. It looks easy enough to me to support the desired behavior in XLogReadBufferExtended. I wasn't planning to support it in ReadBuffer itself. (Probably the path of least resistance is to define it as meaning the same thing as RBM_NORMAL, so far as bufmgr.c is concerned.) regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs