Re: logfile subprocess and Fancy File Functions

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: logfile subprocess and Fancy File Functions
Date: 2004-07-20 17:59:32
Message-ID: 40FD5D84.8040801@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Bruce Momjian wrote:
> Peter Eisentraut wrote:
>
>>Bruce Momjian wrote:
>>
>>>Peter Eisentraut wrote:
>>>
>>>>Andreas Pflug wrote:
>>>>
>>>>>How should the prefix be named? pgsql_ ?
>>>>
>>>>Make the file names configurable.
>>>
>>>He has code to interpret the file names as timestamps that can be
>>>used in queries. If we allowed full user control over the file name,
>>>he couldn't do that.
>>
>>I can't see this working. As you know, there are constantly people who
>>want to install and configure PostgreSQL in the weirdest ways. If we
>>tell everybody, you log files must be named like this, it will start
>>all over again.
>>
>>Maybe it would be better if the time stamps of the files are used as
>>time stamps in queries.

Imagine an older logfile was edited with lets say emacs, which will
rename the old and create a new file. Or after log_directory was
changed, the files from the old location are copied to the new location.
This would garble the log_dir_ls output badly.

The logfilename currently also includes the postmaster's pid, there's no
file metadata that could take this information safely.

Apparently it's best to invent a log_file_prefix = 'pgsql_' guc variable.

>
>
> In fact one idea would be to add new stat() columns for
> creation/mod/access file times to the directory listing command.

Actually, a preliminary version of pg_dir_ls did also return some stat
data. I removed this, in favor of functions like pg_file_length.

SELECT fn, pg_file_length(fn)
FROM pg_dir_ls('/etc', true) AS fn
WHERE fn like '/etc/p%'

I certainly could supply a record-returning pg_dir_ls
(fn text, fullfn text, len int8, ctime timestamp, atime timestamp, mtime
timestamp)

Regards,
Andreas

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2004-07-20 18:15:55 Re: logfile subprocess and Fancy File Functions
Previous Message Simon Riggs 2004-07-20 17:27:58 Re: [HACKERS] Point in Time Recovery