Re: [COMMITTERS] pgsql: Improve corner cases in pg_ctl's new wait-for-postmaster-startup

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [COMMITTERS] pgsql: Improve corner cases in pg_ctl's new wait-for-postmaster-startup
Дата
Msg-id 7649.1306899050@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: Improve corner cases in pg_ctl's new wait-for-postmaster-startup  (Fujii Masao <masao.fujii@gmail.com>)
Ответы Re: [COMMITTERS] pgsql: Improve corner cases in pg_ctl's new wait-for-postmaster-startup  (Fujii Masao <masao.fujii@gmail.com>)
Список pgsql-hackers
Fujii Masao <masao.fujii@gmail.com> writes:
> On Sat, May 28, 2011 at 3:13 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Also, if the postmaster.pid file is not there at any point after we've
>> waited 5 seconds, assume the postmaster has failed and report that, rather
>> than almost-certainly-fruitlessly continuing to wait. �The pidfile should
>> appear almost instantly even when there is extensive startup work to do,
>> so 5 seconds is already a very conservative figure. �This part is per a
>> gripe from MauMau --- there might be better ways to do it, but nothing
>> simple enough to get done for 9.1.

> The postmaster.pid can remain even after the server dies, for example,
> in the case where it dies with PANIC or SIGKILL.

Yeah, there are other corner cases still not covered.

> To address this corner
> case, we should check whether postmaster is really running by sending
> the signal 0 after we read postmater.pid file? Attached patch does that.

I find myself unimpressed by this approach, because it supposes that the
postmaster got as far as creating postmaster.pid.

My preference for fixing this would be to arrange for the postmaster to
be the direct child of pg_ctl, so that we could watch for SIGCHLD to
detect premature postmaster exit.  Right now that doesn't work because
we are invoking an intermediate shell via system(), but I think that
could be avoided with a bit more effort (ie, an explicit fork and exec).
Not sure how that all translates into Windows-ville, though.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Improve corner cases in pg_ctl's new wait-for-postmaster-startup
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Any idea for serializing INSERTING SERIAL column?