On 28/12/2018 22:13, Tom Lane wrote:
Heikki Linnakangas <hlinn...@iki.fi> writes:
Another idea would be to call setsid() in pg_ctl, after forking
postmaster, like in Paul's original patch. That solves 1. and 2. To
still do 3., add a signal handler for SIGINT in pg_ctl, which forwards
the SIGINT to the postmaster process. Thoughts on that?
That seems like a nice idea.
Here's a patch to implement that. Seems to work. There is a small window
between launching postmaster and installing the signal handler, though,
where CTRL-C on pg_ctl will not abort the server launch. I think that's
acceptable.
Looking at the existing docs in the "Starting the Database Server"
section, and the pg_ctl reference page, I don't think we need to change
anything. This is the same user-visible behavior as before, except for
the case with a script like in Paul's original post. And that is almost
a bug fix: the manual says that pg_ctl "will start the server in the
background", and I think the new behavior matches that description
better than the old one. Perhaps we should mention something about how
CTRL-C will interrupt the server launch in "pg_ctl -w" mode, but that
isn't new, either.
I don't think we should backpatch this. We haven't heard any complaints
about this until now, and it seems plausible, although unlikely, that
someone might be relying on the current behavior.
- Heikki