Re: possible bug: orphaned files left after immediate shutdown during DDL - Mailing list pgsql-bugs

From Tom Lane
Subject Re: possible bug: orphaned files left after immediate shutdown during DDL
Date
Msg-id 20348.1297310326@sss.pgh.pa.us
Whole thread Raw
In response to possible bug: orphaned files left after immediate shutdown during DDL  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: possible bug: orphaned files left after immediate shutdown during DDL  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-bugs
Jeff Davis <pgsql@j-davis.com> 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [Fwd: ERROR: cannot extract system attribute from minimal tuple]
Next
From: Jeff Davis
Date:
Subject: Re: possible bug: orphaned files left after immediate shutdown during DDL