Re: shouldn't we log permission errors when accessing the configured trigger file?

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: shouldn't we log permission errors when accessing the configured trigger file?
Дата
Msg-id CABUevEwo5fc5Sxn2wrNtA-uz+Q6cnHj+OtGm6h534fUtumXnLw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: shouldn't we log permission errors when accessing the configured trigger file?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: shouldn't we log permission errors when accessing the configured trigger file?  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
On Mon, Jan 27, 2014 at 3:43 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Sun, Jan 26, 2014 at 1:03 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> For some reason CheckForStandbyTrigger() doesn't report permission
> errors when stat()int the trigger file. Shouldn't we fix that?
>
> static bool
> CheckForStandbyTrigger(void)
> {
> ...
>         if (stat(TriggerFile, &stat_buf) == 0)
>         {
>                 ereport(LOG,
>                                 (errmsg("trigger file found: %s", TriggerFile)));
>                 unlink(TriggerFile);
>                 triggered = true;
>                 fast_promote = true;
>                 return true;
>         }
>
> Imo the stat() should warn about all errors but ENOENT?

Seems reasonable.  It could lead to quite a bit of log spam, I
suppose, but the way things are now could be pretty mystifying if
you've located your trigger file somewhere outside $PGDATA, and a
parent directory is lacking permissions.

+1. Since it actually indicates something that's quite broken (since with that you can never make the trigger work until you fix it), the log spam seems like it would be appropriate. (Logspam is never nice, but a single log line is also very easy to miss - this should log enough that you wouldn't) 


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: shouldn't we log permission errors when accessing the configured trigger file?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Standalone synchronous master