Re: Allow interrupts on waiting standby

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: 'Michael Paquier' <michael(dot)paquier(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 07:02:32
Message-ID: 0A3221C70F24FB45833433255569204D1F6BDA49@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Hi Michael, Simon,

From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Michael Paquier
> > 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.

So, I understood you agreed that CHECK_FOR_INTERRUPTS() here does nothing. But your patch still calls it:

+ /* An interrupt may have occurred while waiting */
+ CHECK_FOR_INTERRUPTS();

I got confused because the problem is not defined in this thread. What problem does this patch address? These ones?

* The startup process terminates as soon as postmaster dies.
* pg_stat_activity does not show the wait event of startup process waiting for a recovery conflict resolution.

My guess about why you decided to not call HandleStartupProcInterrupts() here is:

* Respond to postmaster death here.
* No need to reload config file here because there's no parameter to affect this conflict wait. But max_standby_{archive | streaming}_delay seems to affect the wait period.
* No need to handle SIGTERM and exit here, because the startup process doesn't wait for a conflict resolution here when he can terminate.

I think you can call HandleStartupProcInterrupts() here, instead of checking postmaster death. Did you perform tests?

Did Simon's committed patch solve the problem as expected?

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ideriha, Takeshi 2017-03-30 07:11:55 Re: [WIP] RE: DECLARE STATEMENT setting up a connection in ECPG
Previous Message Michael Paquier 2017-03-30 06:16:51 Re: Allow interrupts on waiting standby