Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A6378B5DC6A for ; Tue, 27 Sep 2011 03:03:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 65084-01 for ; Tue, 27 Sep 2011 06:03:36 +0000 (UTC) X-Greylist: delayed 00:07:49.985429 by SQLgrey-1.8.0-rc2 Received: from exprod7og124.obsmtp.com (exprod7og124.obsmtp.com [64.18.2.26]) by mail.postgresql.org (Postfix) with ESMTP id 38831B5DD0E for ; Tue, 27 Sep 2011 03:03:04 -0300 (ADT) Received: from mail-ey0-f170.google.com ([209.85.215.170]) (using TLSv1) by exprod7ob124.postini.com ([64.18.6.12]) with SMTP ID DSNKToFnF/lkz69H7/gw+DnEYerSR/4kILW1@postini.com; Mon, 26 Sep 2011 23:03:04 PDT Received: by mail-ey0-f170.google.com with SMTP id 6so4137351eyh.29 for ; Mon, 26 Sep 2011 23:03:03 -0700 (PDT) Received: by 10.216.8.5 with SMTP id 5mr4580115weq.68.1317102911405; Mon, 26 Sep 2011 22:55:11 -0700 (PDT) Received: from [172.20.9.94] ([62.96.109.122]) by mx.google.com with ESMTPS id es10sm28561383wbb.4.2011.09.26.22.55.04 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Sep 2011 22:55:09 -0700 (PDT) Message-ID: <4E816532.4050904@enterprisedb.com> Date: Tue, 27 Sep 2011 07:54:58 +0200 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.2.21) Gecko/20110831 Icedove/3.1.13 MIME-Version: 1.0 To: Simon Riggs CC: Fujii Masao , PostgreSQL-development Subject: Re: bug of recovery? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201109/1445 X-Sequence-Number: 195634 On 26.09.2011 21:06, Simon Riggs wrote: > On Mon, Sep 26, 2011 at 10:50 AM, Fujii Masao wrote: > >> Currently, if a reference to an invalid page is found during recovery, >> its information >> is saved in hash table "invalid_page_tab". Then, if such a reference >> is resolved, >> its information is removed from the hash table. If there is unresolved >> reference to >> an invalid page in the hash table at the end of recovery, PANIC error occurs. >> >> What I'm worried about is that the hash table is volatile. If a user restarts >> the server before reaching end of recovery, any information in the >> hash table is lost, >> and we wrongly miss the PANIC error case because we cannot find any unresolved >> reference. That is, even if database is corrupted at the end of recovery, >> a user might not be able to notice that. This looks like a serious problem. No? >> >> To prevent the above problem, we should write the contents of the hash table to >> the disk for every restartpoints, I think. Then, when the server >> starts recovery, >> it should reload the hash table from the disk. Thought? Am I missing something? > > That doesn't happen because the when we stop the server it will > restart from a valid restartpoint - one where there is no in-progress > multi-phase operation. > > So when it replays it will always replay both parts of the operation. I think you're mixing this up with the multi-page page split operations in b-tree. This is different from that. What the "invalid_page_tab" is for is the situation where you for example, insert to a page on table X, and later table X is dropped, and then you crash. On WAL replay, you will see the insert record, but the file for the table doesn't exist, because the table was dropped. In that case we skip the insert, note what happened in invalid_page_tab, and move on with recovery. When we see the later record to drop the table, we know it was OK that the file was missing earlier. But if we don't see it before end of recovery, we PANIC, because then the file should've been there. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com