Re: Patch to log usage of temporary files

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org, Bill Moran <wmoran(at)collaborativefusion(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to log usage of temporary files
Date: 2007-01-02 23:20:37
Message-ID: 23090.1167780037@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bill Moran <wmoran(at)collaborativefusion(dot)com> writes:
> In response to Alvaro Herrera <alvherre(at)commandprompt(dot)com>:
>> Please change things to save the stat() syscall when the feature is not
>> in use.

> Do you have a suggestion on how to do that and still have the PG_TRACE1()
> work? That was specifically requested by Simon Riggs.

Well, we are NOT paying a stat() call on every single file close,
whether Simon wants it or not. PG_TRACE1 doesn't even do anything
on non-Solaris platforms, for pete's sake.

Perhaps it would be reasonable to define trace_temp_files as the minimum
file size to log; then you could do something like

if (trace_temp_files > 0)
{
if (stat(vfdP->fileName, &filestats) < 0)
elog(LOG, ...);
else
{
if (filestats.st_size / BLCKSZ >= trace_temp_files)
ereport(LOG, ...);
PG_TRACE1(temp__file__cleanup, filestats.st_size);
}
}

Note that elog(ERROR) is quite inappropriate here.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonah H. Harris 2007-01-03 01:08:11 Re: WITH support
Previous Message Bill Moran 2007-01-02 22:15:31 Re: Patch to log usage of temporary files

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2007-01-03 08:52:29 Re: xlog directory at initdb time
Previous Message Bill Moran 2007-01-02 22:15:31 Re: Patch to log usage of temporary files