From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, "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-04-16 22:55:14 |
Message-ID: | 20140416225514.GL7443@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Jan 27, 2014 at 03:45:38PM +0100, Magnus Hagander wrote:
> On Mon, Jan 27, 2014 at 3:43 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> 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.
>
>
> +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)
I have developed the attached patch to address this issue.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
Attachment | Content-Type | Size |
---|---|---|
trigger.diff | text/x-diff | 530 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2014-04-16 23:08:16 | Re: test script, was Re: [COMMITTERS] pgsql: psql: conditionally display oids and replication identity |
Previous Message | Bruce Momjian | 2014-04-16 22:42:04 | Re: pg_get_viewdefs() indentation considered harmful |