DROP TABLESPACE needs crash-resistance

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: DROP TABLESPACE needs crash-resistance
Date: 2010-11-09 16:58:45
Message-ID: AANLkTi=fhF8-0axPOc5okaHZ4o5EBXN_kTDdWcpMO-W_@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Solving this problem has become quite critical since the the platform where
Postgres is being used is supposed to run unattended. The problem is
currently
being solved by an application specific kluge, which is highly undesirable
as
this kluge might not work as the application evolves.

Has this problem been reported/discussed earlier? Any suggestions to avoid
this
situation?

I have a hackish idea of listing files created by yet-to-be-committed
transactions be
listed after every checkpoint so that the recovery code can remember to
remove
such files if the creating transaction's commit record is not encountered
until end of recovery. But this would require every smgrcreate() to be
communicated
to the BGWriter, and somehow make BGWriter forget this list when the
transaction
commits.

Regards,
--
gurjeet.singh
@ EnterpriseDB - The Enterprise Postgres Company
http://www.EnterpriseDB.com

singh(dot)gurjeet(at){ gmail | yahoo }.com
Twitter/Skype: singh_gurjeet

Mail sent from my BlackLaptop device

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2010-11-09 17:01:45 Re: Protecting against unexpected zero-pages: proposal
Previous Message Gurjeet Singh 2010-11-09 16:44:04 Re: Protecting against unexpected zero-pages: proposal