Re: [Patch] Create a new session in postmaster by calling setsid()

Paul Guo <pguo@pivotal.io>

From: Paul Guo <pguo@pivotal.io>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Date: 2018-08-06T04:11:26Z
Lists: pgsql-hackers

Attachments

On Thu, Aug 2, 2018 at 10:30 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Paul Guo <pguo@pivotal.io> writes:
> > [ make the postmaster execute setsid() too ]
>
> I'm a bit skeptical of this proposal.  Forcing the postmaster to
> dissociate from its controlling terminal is a good thing in some
> scenarios, but probably less good in others, and manual postmaster
> starts are probably mostly in the latter class.
>
> I wonder whether having "pg_ctl start" do a setsid() would accomplish
> the same result with less chance of breaking debugging usages.
>
>                         regards, tom lane
>

Yes, if considering the case of starting postmaster manually, we can not
create
a new session in postmaster, so pg_ctl seems to be a good place for setsid()
call. Attached a newer patch. Thanks.

Commits

  1. Detach postmaster process from pg_ctl's session at server startup.

  2. Remove silent_mode. You get the same functionality with "pg_ctl -l