Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2o5J-00068V-U1 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2014 20:26:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W2o5J-00029e-A2 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2014 20:26:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2o5H-00027A-Js for pgsql-bugs@postgresql.org; Mon, 13 Jan 2014 20:26:07 +0000 Received: from moutng.kundenserver.de ([212.227.126.171]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2o5E-00021L-Nk for pgsql-bugs@postgresql.org; Mon, 13 Jan 2014 20:26:07 +0000 Received: from anarazel.de (p54AF4121.dip0.t-ipconnect.de [84.175.65.33]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0Lu4L0-1VKMe639io-011jZ0; Mon, 13 Jan 2014 21:26:01 +0100 Received: by anarazel.de (Postfix, from userid 1000) id 0D76F105A05; Mon, 13 Jan 2014 21:26:00 +0100 (CET) Date: Mon, 13 Jan 2014 21:26:00 +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: <20140113202600.GB14861@awork2.anarazel.de> References: <20140106134815.GE28320@alap2.anarazel.de> <52CABF3E.2050004@vmware.com> <17450.1389644346@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17450.1389644346@sss.pgh.pa.us> X-Provags-ID: V02:K0:4iWhGh4e1xuiycD1eQnCEL/e9mGWC2iQESw2viarGGI effBFosATOsIF3Ryy6QNTUdq6skEm5iKJFPq2eMPt3w/eYAFUc XZBL+VCZfGgEz0IuC/vqb/JQSOGBwbZ5+D+orMJYyOEpKVLYCl vvOPQMM6sEtCwGaPTUCveq8bVD9NCCUn3DIvATDVhMOYtQKjLs PFailjHRUTEG+Ot/tZckVWgfFjGYcnAy66GplYGI+Y5rg5D2c1 Tt7/7zm4e+TRhu++6V6v5KhOEzc5ewGdzdZ9T9eXLgOuVB/25X 7Nr4JlKWe1JgAmMI9RYwMhN++e2V97aE3dPyNw3e81L8d2wmvp gNjSESSOTWY55AmWDeYDEEQNaVW3s701RH/q24bMi 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 15:19:06 -0500, Tom Lane wrote: > >> ISTM we can just use RBM_ZERO_ON_ERROR instead of RBM_NORMAL. > > > That'd be horrendously dangerous. It would silently zap any page with > > any error on it. But we could add a new ReadBufferMode that returns > > InvalidBuffer on error, without zeroing the page. > > 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. 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. > Will go fix this if there's not any objection to that plan. Fine with me! 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