Re: Allow interrupts on waiting standby

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow interrupts on waiting standby
Date: 2017-03-30 06:16:51
Message-ID: CAB7nPqT1K1e-+Mh1NFqNfKo4XxBCaNZR8HJjNE7ujpXkU0q34g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 30, 2017 at 1:52 PM, Tsunakawa, Takayuki
<tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com> wrote:
> From: pgsql-hackers-owner(at)postgresql(dot)org
>> > (2) standby.c
>> > Do we need to specify WL_LATCH_SET? Who can set the latch? Do the
>> backends who ended the conflict set the latch?
>>
>> This makes the process able to react on SIGHUP. That's useful for
>> responsiveness.
>
> Oh, I see. But how does the startup process respond quickly? It seems that you need to call HandleStartupProcInterrupts() instead of CHECK_FOR_INTERRUPTS(). But I'm not sure whether HandleStartupProcInterrupts() can be called here.

Bah. Of course you are right. We don't care about SetLatch() here as
signals are processed with a different code path than normal backends.

>> > (3) standby.c
>> > + if (rc & WL_LATCH_SET)
>> > + ResetLatch(MyLatch);
>> > +
>> > + /* emergency bailout if postmaster has died */
>> > + if (rc & WL_POSTMASTER_DEATH)
>> > + proc_exit(1);
>> >
>> > I thought the child processes have to terminate as soon as postmaster
>> vanishes. So, it would be better for the order of the two if statements
>> above to be reversed. proc_exit() could be exit(), as some children do
>> in postmaster/*.c.
>>
>> OK, reversed this order.
>
> I think exit() instead of proc_exit() better represents what the code wants to do -- terminate the process ASAP without cleaning up. Many other background children do so.

Hm... OK.
--
Michael

Attachment Content-Type Size
standby-delay-latch-v5.patch application/octet-stream 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tsunakawa, Takayuki 2017-03-30 07:02:32 Re: Allow interrupts on waiting standby
Previous Message Haribabu Kommi 2017-03-30 06:03:53 Re: [WIP] RE: DECLARE STATEMENT setting up a connection in ECPG