Re: pg_relation_size locking - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pg_relation_size locking
Date
Msg-id 20051212160050.GN19555@surnet.cl
Whole thread Raw
In response to pg_relation_size locking  (Andreas Pflug <pgadmin@pse-consulting.de>)
List pgsql-hackers
[Resend: apparently there's a problem with my mail server]

Andreas Pflug wrote:
> Until recently, pg_relation_size used SearchSysCache to locate the 
> relation to examine, and calculated the file location from that 
> information. Starting with dbsize.c V1.5 (committed after Beta2), 
> relation_open(.., AccessShareLock) is used. This is very unfortunate 
> because it will not allow to observe a table growing while it is 
> populated, e.g. with a lengthy COPY; pg_relation_size will be blocked. 
> After reverting to 1.4, everything was fine again.

The diff:
http://projects.commandprompt.com/projects/public/pgsql/changeset/23120

The problem with the original coding was that it used the table Oid to
look up the file name, which is wrong.  (Test it with a table that has
been clustered or an index that has been reindexed.)

We could use a SysCache on filenode, if there was one.  Unfortunately I
don't think we have it.

> Can we have this reverted/fixed?

If you can see a way without reintroducing the old bugs, let me know.


-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Different length lines in COPY CSV
Next
From: "Mike G."
Date:
Subject: Re: Different length lines in COPY CSV