Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B57E51337B69 for ; Wed, 9 Feb 2011 23:58:54 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 23325-03 for ; Thu, 10 Feb 2011 03:58:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 44A11133616B for ; Wed, 9 Feb 2011 23:58:47 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p1A3wkgk020349; Wed, 9 Feb 2011 22:58:46 -0500 (EST) To: Jeff Davis cc: pgsql-bugs@postgresql.org Subject: Re: possible bug: orphaned files left after immediate shutdown during DDL In-reply-to: <1297309026.11375.7.camel@jdavis-ux.asterdata.local> References: <1297309026.11375.7.camel@jdavis-ux.asterdata.local> Comments: In-reply-to Jeff Davis message dated "Wed, 09 Feb 2011 19:37:06 -0800" Date: Wed, 09 Feb 2011 22:58:46 -0500 Message-ID: <20348.1297310326@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/92 X-Sequence-Number: 29364 Jeff Davis writes: > Case: > BEGIN; > CREATE TABLE foo AS SELECT generate_series(1,1000); > CHECKPOINT; > SELECT relfilenode FROM pg_class WHERE relname='foo'; > Let's say that returns 23456. Send the postmaster a SIGQUIT (immediate > shutdown), and then restart. The file 23456 is still in the filesystem, > but there's no record in pg_class for it. I don't see any obvious path > where it will be removed, so it looks like it will just stay there > forever. > My question is: is this a conscious decision to be paranoid during > recovery, or is this a bug? It's intentional ... not that other people haven't complained about it before. Remember that what you have done is forced a crash, and recovery from it is crash recovery. If we proactively removed such files we would very possibly be destroying evidence of forensic value. IMO, immediate shutdown is not a tool to be used at random, and this isn't something we need to fix. regards, tom lane