Re: DROP TABLESPACE needs crash-resistance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
Cc: PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DROP TABLESPACE needs crash-resistance
Date: 2010-11-09 17:24:44
Message-ID: 23796.1289323484@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com> writes:
> We are facing a problem in dropping a tablespace after crash recovery. The
> recovery starts from the last checkpoint, but the tables that were created
> by
> a transaction in a tablespace before the checkpoint are still lying around;
> the
> transaction had not finished by the time of crash.

> After recovery, when the app tries to drop the tablespace, the command fails
> because the tablespace directory is not empty.

Hmm. The reason DROP TABLESPACE fails in that case, rather than just
arbitrarily rm -rf'ing the files, is fear of deleting valuable data by
accident. I suppose we could have a mode that deletes the files without
any manual intervention, but personally I'd regard that as a foot-gun.

> Solving this problem has become quite critical since the the platform where
> Postgres is being used is supposed to run unattended.

I'm not entirely clear as to the use-case for unattended DROP TABLESPACE?
That doesn't really seem like an operation you should need on a routine
basis.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2010-11-09 17:31:01 Re: Protecting against unexpected zero-pages: proposal
Previous Message David E. Wheeler 2010-11-09 17:18:51 Re: proposal: plpgsql - iteration over fields of rec or row variable