pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Hannes Erven <hannes@erven.at>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Unused files in the database directory after crashed VACUUM FULL
Date: Sun, 10 Feb 2019 10:41:08 -0500
Message-ID: <17143.1549813268@sss.pgh.pa.us> (raw)
In-Reply-To: <da60fd67-f660-39f2-764f-c5792ca568e8@erven.at>
References: <da60fd67-f660-39f2-764f-c5792ca568e8@erven.at>

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




view thread (6+ messages)  latest in thread

Message-ID: <17143.1549813268@sss.pgh.pa.us>
Permalink:  ../17143.1549813268@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17143.1549813268@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hannes@erven.at
  Subject: Re: Unused files in the database directory after crashed VACUUM FULL
  In-Reply-To: <17143.1549813268@sss.pgh.pa.us>
  References: <da60fd67-f660-39f2-764f-c5792ca568e8@erven.at> <17143.1549813268@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox