File leak?

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: pgsql-hackers(at)postgresql(dot)org
Subject: File leak?
Date: 2004-06-12 12:48:59
Message-ID: Pine.OSF.4.58.0406121524390.390741@kosh.hut.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


template1=# BEGIN;
BEGIN
template1=# CREATE TABLE foobar (foo char(10));
CREATE TABLE
template1=# select relname, relfilenode from pg_class where
relname='foobar';
relname | relfilenode
---------+-------------
foobar | 66372
(1 row)

> killall -9 postmaster
> ll data/base/1/
-rw------- 1 hlinnaka hlinnaka 0 Jun 12 15:33 data/base/1/66372

Unless I'm missing something, that file is left there forever. Not such a
big deal with an empty file, but if you create a new table and load it
with data in the same transaction...

Can you guys confirm?

The problem seems to be in storage/smgr.c. The code keeps track of files
created in the transaction in backend memory. That information is lost on
crash, and there is nothing to clean up the mess later.

I wonder if we could clean up those lost files on database recovery or
vacuum. Do we have a list of valid relfilenodes somewhere? Is pg_class
enough?

- Heikki

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Carl E. McMillin 2004-06-12 14:42:50 Re: I just got it: PostgreSQL Application Server -- a new project.
Previous Message pgsql 2004-06-12 12:45:38 Re: I just got it: PostgreSQL Application Server -- a