Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9XdU-0001Mp-I9 for pgsql-bugs@arkaria.postgresql.org; Sat, 13 May 2017 14:03:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d9XdU-0006lx-51 for pgsql-bugs@arkaria.postgresql.org; Sat, 13 May 2017 14:03:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d9Xcn-0004jv-3R for pgsql-bugs@postgresql.org; Sat, 13 May 2017 14:02:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d9Xcj-0002kY-Te for pgsql-bugs@postgresql.org; Sat, 13 May 2017 14:02:24 +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 v4DE2I6O001806; Sat, 13 May 2017 10:02:18 -0400 From: Tom Lane To: nilesoien@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14651: Uninitialized page fix corrupted TOAST table In-reply-to: <20170512212723.1787.4338@wrigleys.postgresql.org> References: <20170512212723.1787.4338@wrigleys.postgresql.org> Comments: In-reply-to nilesoien@gmail.com message dated "Fri, 12 May 2017 21:27:23 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1804.1494684138.1@sss.pgh.pa.us> Date: Sat, 13 May 2017 10:02:18 -0400 Message-ID: <1805.1494684138@sss.pgh.pa.us> 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 nilesoien@gmail.com writes: > It's been doing this ever since (about two days). I think I figured out > which table data.pg_toast.pg_toast_9303780 supports : > $ oid2name -o 9303780 -d data >> From database "data": > Filenode Table Name > ------------------------- > 9303780 rdvtrack_fd05 That's not hugely reliable because filenode isn't necessarily equal to oid. I'd try this to be sure: select relname from pg_class where reltoastrelid = 'pg_toast.pg_toast_9303780'::regclass; > And interestingly I can still select from that table : > data=# select count(*) from hmi.rdvtrack_fd05; A "select count(*)" would only fetch the main table rows, not out-of-line TOAST data, so this proves little. What you want is to see if you can retrieve all the data in the table. An easy way to do that is to try to pg_dump it ("pg_dump -t problem_table ..."). > It looks like there's a damaged block in the TOAST table, but > does the fact that I can do the select on the table supported by > the TOAST table mean that this damaged block has no entries? It's possible but I'd hardly bet on it yet. > Can I do this : > SET zero_damaged_pages = on; > VACUUM FULL data.pg_toast.pg_toast_9303780; > (I'll get a warning that it's zeroing out the damaged block) > REINDEX TABLE data.pg_toast.pg_toast_9303780; You can, but my bet is that you'll lose data. You may have little choice though. (I wouldn't bother with the FULL, btw, since you already know that a regular vacuum will hit the page.) Where you probably will end up is identifying the main-table row(s) that reference this page and deleting them. An angle that might be interesting is to check the physical length of the toast table and see whether the problem page is the last page or nearly last. If so, the problem might have originated in a failed relation-extension attempt. This would also suggest that the main table row(s) referencing the bad page are recent. 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