Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2p5F-00007r-Sc for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2014 21:30:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W2p5F-0007Ou-Au for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2014 21:30:09 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2p5D-0007Mc-NZ for pgsql-bugs@postgresql.org; Mon, 13 Jan 2014 21:30:07 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2p5A-00066z-HG for pgsql-bugs@postgresql.org; Mon, 13 Jan 2014 21:30:07 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 00AAA2860F; Mon, 13 Jan 2014 13:30:03 -0800 (PST) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id EF05B403DD; Mon, 13 Jan 2014 13:30:02 -0800 (PST) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id CD5AEC0062; Mon, 13 Jan 2014 13:30:37 -0800 (PST) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Mon, 13 Jan 2014 13:30:35 -0800 (PST) Message-ID: <52D45AD7.9080406@vmware.com> Date: Mon, 13 Jan 2014 23:29:59 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: Andres Freund CC: Tom Lane , Sergey Konoplev , matioli.matheus@gmail.com, pgsql-bugs , Maxim Boguk , =?UTF-8?B?0JzQsNC60YHQuNC8INCf0LDQvdGH0LXQvdC60L4=?= , =?UTF-8?B?0KHQuNC30L7QsiDQodC10YDQs9C10Lkg0J/QsA==?= =?UTF-8?B?0LLQu9C+0LLQuNGH?= Subject: Re: Hot standby 9.2.6 -> 9.2.6 PANIC: WAL contains references to invalid pages 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> In-Reply-To: <20140113210245.GD14861@awork2.anarazel.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.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 On 01/13/2014 11:02 PM, Andres Freund wrote: > On 2014-01-13 22:40:32 +0200, Heikki Linnakangas wrote: >> With RBM_NORMAL_ZERO_OK, AFAICS we're talking about a tiny patch to >> XLogReadBufferExtended. bufmgr.c doesn't need to do anything about the new >> mode, as it's XLogReadBuffer that does the the check for zero pages. Per >> attached patch (for demonstration purposes only, you also need to add the >> new mode to the header file and adjust comments). > > I thought about that approach at first as well, but I am not so sure > it's sufficient. Isn't it quite possible that we'd end up reading a page > that was *partially* written during a crash and due to that has a > corrupted checksum? There won't be any protection due to WAL replay/full > page writes against that case here. 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. It's possible that there's a torn page on disk on block X, and we're vacuuming page X + 1. The page will be fixed by a later record in the WAL, before we reach consistency, but the ReadBuffer call from btree_xlog_vacuum() will throw an error. > 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. - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs