Alvaro Herrera <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to