pg_database_size issue an error (ERROR: could not stat file "base/16384/20041": Permission denied)

From: Christophe GUILLOT <cguillot(dot)abo(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_database_size issue an error (ERROR: could not stat file "base/16384/20041": Permission denied)
Date: 2012-12-10 15:21:12
Message-ID: CAJHRyAEJhwvHE25nk+-GBKZnMPWy8O9UhR3XgTw9SJc+7oZmZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,
The usage of the pg_database_size function generate a lot of "permission
denied" log errors.
Typical message is: ERROR: could not stat file "base/16384/20041":
Permission denied.

As a short description:
- PostgreSQL 9.2.1/64 bits
- our system is running on windows platform (W7, W2008)
- frequent alter/create/drop of tables
- call to pg_database_size, sometimes.

When logging file system activity (using procmon, W7), the query made on
the file printed in the log message return a “DELETE PENDING” state and i
only find a handle to this file owned by a postgres executable.

After code exploration, it looks like the functions from "dbsize.c" should
use the same trick as found in "md.c" (i mean the FILE_POSSIBLY_DELETED
macro) for testing each "stat()" returned error code.

So, is it a good idea to patch dbsize.c with the same macro, which on
windows platform include the EACCES error code as a possibly deleted file,
or not. Or is it the wrong way ? I didn't try to patch yet.

Thanks for your help,

Christophe

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-12-10 15:28:56 Re: Support for REINDEX CONCURRENTLY
Previous Message Andres Freund 2012-12-10 14:51:40 Re: Support for REINDEX CONCURRENTLY