Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id D762B9FB8EA for ; Tue, 6 Mar 2007 00:29:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 78478-06-3 for ; Tue, 6 Mar 2007 00:29:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 4620C9FB952 for ; Tue, 6 Mar 2007 00:29:49 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l264TkTk026501; Mon, 5 Mar 2007 23:29:46 -0500 (EST) To: "Roger Pan" cc: pgsql-admin@postgresql.org Subject: Re: "failed to re-find parent key" question In-reply-to: References: Comments: In-reply-to "Roger Pan" message dated "Mon, 05 Mar 2007 12:53:45 -0500" Date: Mon, 05 Mar 2007 23:29:46 -0500 Message-ID: <26500.1173155386@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, BAYES_50, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200703/19 X-Sequence-Number: 24843 "Roger Pan" writes: > We use postgreSQL 8.1.2 in Solaris 9 platform to maintain very = > important business data. If it's as important as all that, you should make more of an effort to keep up-to-date with PG minor releases... > PANIC: failed to re-find parent key in "1560660" > I know the problem " failed to re-find parent key" has been fixed in = > the newer release. My question is how we can recover the data in this = > case? The difficult is the disk with postgres data system is full.=20 A quick and dirty solution would be to do pg_resetxlog, but the problem is that it's difficult to predict how much corruption or data loss would result. If the data is really worth an effort to save, you might consider making a hacked-up build in which this PANIC is reduced to a WARNING, which you use just long enough to boot up and shut down. I think it'd work to change (in src/backend/access/nbtree/nbtinsert.c) /* Check for error only after writing children */ if (pbuf == InvalidBuffer) elog(ERROR, "failed to re-find parent key in \"%s\"", RelationGetRelationName(rel)); /* Recursively update the parent */ _bt_insertonpg(rel, pbuf, stack->bts_parent, 0, NULL, new_item, stack->bts_offset, is_only); to /* Check for error only after writing children */ if (pbuf == InvalidBuffer) elog(WARNING, "failed to re-find parent key in \"%s\"", RelationGetRelationName(rel)); else /* Recursively update the parent */ _bt_insertonpg(rel, pbuf, stack->bts_parent, 0, NULL, new_item, stack->bts_offset, is_only); After that, reboot into a standard postmaster, and reindex the index(es) identified by the warning messages. After that, think about an update ;-) regards, tom lane PS: if you try this, I'd *strongly* suggest first making a filesystem-level backup of all of the $PGDATA tree, so that you aren't any worse off if it doesn't work.