Re: logfile subprocess and Fancy File Functions - Mailing list pgsql-patches

From Andreas Pflug
Subject Re: logfile subprocess and Fancy File Functions
Date
Msg-id 40FD5D84.8040801@pse-consulting.de
Whole thread Raw
In response to logfile subprocess and Fancy File Functions  (Andreas Pflug <pgadmin@pse-consulting.de>)
Responses Re: logfile subprocess and Fancy File Functions
List 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



pgsql-patches by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] Point in Time Recovery
Next
From: Peter Eisentraut
Date:
Subject: Re: logfile subprocess and Fancy File Functions