Re: Something is fairly whacko about shutdown in CVS HEAD - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Something is fairly whacko about shutdown in CVS HEAD
Date
Msg-id 11757.1183298802@sss.pgh.pa.us
Whole thread Raw
In response to Re: Something is fairly whacko about shutdown in CVS HEAD  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Tom Lane wrote:
>> To resolve this I think we need a clearer definition of the autovac
>> launcher's role in life.  I see that it is attached to shared memory;
>> is it supposed to be able to execute transactions or otherwise do
>> anything the bgwriter might have to clean up after?

> No; the launcher is attached to shared memory, but it doesn't connect to
> databases and it doesn't execute transactions either.  In fact, the
> launcher cannot do anything when the postmaster is not running (or when
> it is not in a state where it doesn't want to start processes, anyway),
> because it (the launcher) is only capable of sending signals to
> postmaster (apart from that, it ocasionally grabs lwlocks, reads the
> pg_database flat file, pgstats, and the Xid counter in shared memory).
> It doesn't write anything.  I think it is perfectly acceptable to have
> the launcher shut down in parallel with bgwriter.

[ after sleeping on it... ]  That's probably okay as far as bgwriter
goes, but I think it's a bad idea for anything connected to shared
memory to outlive the postmaster.  To do so opens risks that some
platforms might treat the postmaster's shmctl(IPC_RMID) differently
than others.  So I want the postmaster to not exit until it's seen
the launcher quit.  It's quite easy to make this happen if we treat
the launcher more like a backend, and don't start bgwriter shutdown
till it's gone.  (I have a patch I've been testing that does it that
way.)  Allowing the two to shut down in parallel seems more complex,
though if you see a reasonable way to make it work, propose a patch.
        regards, tom lane


pgsql-hackers by date:

Previous
From: KaiGai Kohei
Date:
Subject: [ANN] SE-PostgreSQL 1.0 Beta released
Next
From: Tom Lane
Date:
Subject: Restartable signals 'n all that