Re: Add client connection check during the execution of the query

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add client connection check during the execution of the query
Date: 2021-03-06 04:53:09
Message-ID: CALNJ-vTMC=qOg7cdyu_CbPZsvhnwG_-gFaFfCen-DMQyoOxWiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

For v4-0002-some-fixups.patch :

+ if (client_connection_check_interval > 0)
+ enable_timeout_after(CLIENT_CONNECTION_CHECK_TIMEOUT,

+ /* Start timeout for checking if the client has gone away if necessary.
*/
+ if (client_connection_check_interval)

It would be better if the second if condition is aligned with that of the
first (> 0).

For v4-0001-Detect-dropped-connections-while-running-queries.patch :

+ Sets a time interval, in milliseconds, between periodic

I wonder if the interval should be expressed in seconds. Since the
description says: while running very long queries.

Cheers

On Fri, Mar 5, 2021 at 8:07 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:

> On Mon, Mar 1, 2021 at 6:18 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
> wrote:
> > I've done a quick rebase of this the patch and added it to the
> > commitfest. No other changes. Several things were mentioned earlier
> > that still need to be tidied up.
>
> Rebased again due to bitrot. This time I did some actual work:
>
> 1. I didn't like the way it was rearming the timer *in the timer
> handler*; I think it should be done in the CFI(), and only if it
> determines that you're still running a query (otherwise you'll get
> periodic wakeups while you're idle between quieries, which is bad for
> the arctic ice cap; we already handle client going away efficiently
> between queries with WaitEventSet socket readiness).
> 2. The timer handler surely has to set the latch to close a race (cf.
> other similar handlers; between the CFI() and the beginning of the
> sleep, you could handle the signal, set the flag, and then go to sleep
> for 100 years).
> 3. The test might as well use pg_sleep() instead of doing a plpgsql
> busy loop of SELECT queries.
> 4. I prefer the name CLIENT_CONNECTION_CHECK_TIMEOUT instead of
> SKIP_CLIENT_CHECK_TIMEOUT; let's make up only one new name for a
> concept instead of two.
> 5. Miniscule doc change.
>
> I put these into a separate patch for ease of review. I don't claim
> this is ready -- still needs more testing etc -- but it seems to be
> generating the right system calls at the right times now.
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-03-06 05:03:30 Re: Some regular-expression performance hacking
Previous Message Thomas Munro 2021-03-06 04:06:12 Re: Add client connection check during the execution of the query