Re: Something is fairly whacko about shutdown in CVS HEAD

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Something is fairly whacko about shutdown in CVS HEAD
Date: 2007-07-01 14:06:42
Message-ID: 11757.1183298802@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-07-01 16:11:26 Restartable signals 'n all that
Previous Message KaiGai Kohei 2007-07-01 11:54:52 [ANN] SE-PostgreSQL 1.0 Beta released