From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: could not stat promote trigger file leads to shutdown |
Date: | 2019-11-15 09:43:07 |
Message-ID: | 5c794f54-16f1-e4f0-b862-25feda94adf1@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2019-11-15 03:14, Fujii Masao wrote:
>>> One thought is to try to detect the misconfiguration at postmaster
>>> start --- better to fail at startup than sometime later. But I'm
>>> not sure how reliably we could do that.
>> I think that we could do something close to the area where
>> RemovePromoteSignalFiles() gets called. Why not simply checking the
>> path defined by PromoteTriggerFile() at startup time then? I take it
>> that the only thing we should not complain about is stat() returning
>> ENOENT when looking at the promote file defined.
> promote_trigger_file is declared as PGC_SIGHUP,
> so such check would be necessary even while the standby is running.
> Which can cause the server to fail after the startup.
Let me illustrate a scenario in a more lively way:
Say you want to set up promote_trigger_file to point to a file outside
of the data directory, maybe because you want to integrate it with some
external tooling. So you go into your configuration and set
promote_trigger_file = '/srv/foobar/trigger'
and reload the server. Everything is happy. The fact that the
directory /srv/foobar/ does not exist at this point is completely ignored.
Now you become root and run
mkdir /srv/foobar
and, depending circumstances such as root's umask or the permissions of
/srv, your PostgreSQL server crashes immediately. That can't be good.
Also imagine the above steps being run by a configuration management system.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Kubilay Kaan | 2019-11-15 10:06:32 | Getting Recordset through returning refcursor |
Previous Message | Laurenz Albe | 2019-11-15 09:32:11 | Re: Role membership and DROP |