Re: Unused files in the database directory after crashed VACUUM FULL - Mailing list pgsql-general

From Tom Lane
Subject Re: Unused files in the database directory after crashed VACUUM FULL
Date
Msg-id 17143.1549813268@sss.pgh.pa.us
Whole thread Raw
In response to Unused files in the database directory after crashed VACUUM FULL  (Hannes Erven <hannes@erven.at>)
Responses Re: Unused files in the database directory after crashed VACUUM FULL
Re: Unused files in the database directory after crashed VACUUM FULL
List pgsql-general
Hannes Erven <hannes@erven.at> writes:
> I've just had a "VACUUM FULL <table>" crash due to 100% disk usage.
> Clearly my fault, I was expecting the new table to be small enough.

What do you mean by "crash" exactly?  A normal transactional failure
should've cleaned up orphaned files.  I suppose if the kernel decided to
kill -9 the vacuum process, that wouldn't happen --- but that's not
the usual response to out-of-disk-space.

> After freeing up space, restarting the cluster and issuing another 
> VACCUM FULL, I noticed that the cluster was way bigger that it should be.
> In the base/<db>/ folder, there was a large number of files with one 
> certain number that pg_filenode_relation() could not turn into a 
> relation. As that number was just a bit smaller that the 
> pg_relation_filepath() of the table I was working on, I guess these were 
> the remains of the failed VACUUM FULL operation?
> I removed those files and a VACCUM ANALYZE of the whole database went fine.

> So... is this the expected behaviour? Is there a safe procedure how to 
> check/clean up "unnecessary" files in the cluster directory?

You just described it --- verify with pg_filenode_relation that the
file doesn't correspond to any pg_class entry, then manually delete.

(There is a crash-recovery phase that does something similar, but
I think it's only designed to clean up temporary files.)

            regards, tom lane


pgsql-general by date:

Previous
From: Hannes Erven
Date:
Subject: Unused files in the database directory after crashed VACUUM FULL
Next
From: Andrew Gierth
Date:
Subject: Re: Unused files in the database directory after crashed VACUUM FULL