Re: Patch to implement pg_current_logfile() function

Поиск
Список
Период
Сортировка
От Gilles Darold
Тема Re: Patch to implement pg_current_logfile() function
Дата
Msg-id 77ab40e9-2d3f-8333-9da7-d9b53162afa5@dalibo.com
обсуждение исходный текст
Ответ на Re: Patch to implement pg_current_logfile() function  ("Karl O. Pinc" <kop@meme.com>)
Ответы Re: Patch to implement pg_current_logfile() function
Список pgsql-hackers
Le 02/11/2016 à 03:51, Karl O. Pinc a écrit :
> On Mon, 31 Oct 2016 09:26:27 +0100
> Gilles Darold <gilles.darold@dalibo.com> wrote:
>
>> Le 30/10/2016 à 08:04, Karl O. Pinc a écrit :
>> Attached patch v11 include your patch.
>>
>>> I have some questions about logfile_writename():
>>>
>>>  Why does the logfile_open() call fail silently?
>> logfile_open() "fail silently" in logfile_writename(), like in other
>> parts of syslogger.c where it is called, because this is a function()
>> that already report a message when an error occurs ("could not open
>> log file..."). I think I have already replied to this question.
> Please apply the attached patch on top of your v11 patch.
> It simulates a logfile_open() failure.  Upon simulated failure you do
> not get a "currrent_logfile" file, and neither do you get any
> indication of any problems anywhere in the logs.  It's failing
> silently.

Please have a look at line  1137 on HEAD of syslogger.c you will see
that in case of failure function logfile_open() report a FATAL or LOG
error with message:
   errmsg("could not open log file \"%s\": %m", filename);

I don't think adding more error messages after this has any interest
this is why logfile_writename() just return without doing anything.
Other call to logfile_open() have the exact same behavior.

For a real example, create the temporary file and change its system
privileges:
  touch /usr/local/postgresql/data/current_logfiles.tmp  chmod 400 /usr/local/postgresql/data/current_logfiles.tmp

So in this case of failure it prints:
   2016-11-02 09:56:00.791 CET [6321] LOG:  could not open log file
"current_logfiles.tmp": Permission denied

I don't understand what you are expecting more? I agree that "open log"
can confuse a little but this is also a file where we log the current
log file name so I can live with that.


-- 
Gilles Darold
Consultant PostgreSQL
http://dalibo.com - http://dalibo.org




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: Declarative partitioning - another take
Следующее
От: Kuntal Ghosh
Дата:
Сообщение: Re: WAL consistency check facility