Postmaster holding unlinked files for pg_largeobject table

From: Alexander Shulgin <ash(at)commandprompt(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: alexk <alexk(at)commandprompt(dot)com>
Subject: Postmaster holding unlinked files for pg_largeobject table
Date: 2011-06-03 21:45:28
Message-ID: 1307136025-sup-7482@moon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hello Hackers,

There is some strange behavior we're experiencing with one of the customer's DBs (8.4)

We've noticed that free disk space went down heavily on a system, and after a short analysis determined that the reason was that postmaster was holding lots of unlinked files open. A sample of lsof output was something like this:

postmaste 15484 postgres 57u REG 253,0 1073741824 41125093 /srv/pgsql/data/base/352483309/2613.2 (deleted)
postmaste 15484 postgres 58u REG 253,0 1073741824 41125094 /srv/pgsql/data/base/352483309/2613.3 (deleted)
postmaste 15484 postgres 59u REG 253,0 1073741824 41125095 /srv/pgsql/data/base/352483309/2613.4 (deleted)

There were about 450 such (or similar) files, all of them having /2613 in the filename. Since 2613 is a regclass of pg_largeobject and we are indeed working with quite a few large objects in that DB so this is where our problem lies we suspect.

Restarting PostgreSQL obviously helps the issue and the disk space occupied by those unlinked files (about 63GB actually) is reclaimed.

So what happens on that host is that we drop/restore a fresh version of the DB from the production host, followed by a migration script which among other things loads around 16GB of data files as large objects. This happens nightly.

But if we go and run the whole drop/restore and migration manually, the problem doesn't manifest itself right after migration is successfully finished.

Our next thought was that it must be dropdb part of the nightly script that removes the pg_largeobject's files (still we don't know what makes it keep them opened,) but dropping the DB doesn't manifest the problem either.

I'm currently running a VACUUM pg_largeobject on the problematic DB, to see if it triggers the problem, but this didn't happen so far.

At this point it would be nice to hear what are your thoughts. What could cause such behavior?

--
Regards,
Alex

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Esmin Gracic 2011-06-03 22:09:29 Re: Need suggestion
Previous Message Scott Marlowe 2011-06-03 21:39:15 Re: Why are IDLE connections using cpu according to TOP.

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2011-06-03 21:54:17 Re: Error in PQsetvalue
Previous Message Christopher Browne 2011-06-03 21:33:02 Re: Getting a bug tracker for the Postgres project