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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: shouldn't we log permission errors when accessing the configured trigger file?
Date: 2014-01-27 14:43:04
Message-ID: CA+TgmoYBWbtVV6R2ALhy1gqZgKDiWhiWiQLPmT1v--Dt--UZsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jan 26, 2014 at 1:03 PM, Andres Freund <andres(at)2ndquadrant(dot)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.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2014-01-27 14:45:38 Re: shouldn't we log permission errors when accessing the configured trigger file?
Previous Message Stephen Frost 2014-01-27 14:39:34 Re: Custom Scan APIs (Re: Custom Plan node)