Cleaning up unreferenced table files - Mailing list pgsql-patches

From Heikki Linnakangas
Subject Cleaning up unreferenced table files
Date
Msg-id Pine.OSF.4.61.0503060004140.143050@kosh.hut.fi
Whole thread Raw
Responses Re: Cleaning up unreferenced table files  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Here's a patch for the TODO item "Remove unreferenced table files created by transactions
that were in-progress when the server terminated abruptly."

It adds a new function, CleanupStaleRelFiles, that scans through the data
directory and removes all table files that are not mentioned in pg_class
of the corresponding database. CleanupStaleRelFiles is called after WAL
recovery.

Actually, the patch doesn't currently delete the files, just issues a
warning. Testing is easier if the files don't keep getting deleted :).

The patch also adds a GetTablespacePath function similar to
GetDatabasePath that constructs the path to a tablespace symbolic link.
commands/tablespace.c is modified to use it, in addition to the new
CleanupStaleRelFiles function.

- Heikki

Attachment

pgsql-patches by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Harmless space allocation typo
Next
From: Tom Lane
Date:
Subject: Re: Cleaning up unreferenced table files