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

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Maksim Milyutin <milyutinma(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Zhihong Yu <zyu(at)yugabyte(dot)com>
Subject: Re: Add client connection check during the execution of the query
Date: 2021-04-01 12:36:11
Message-ID: CALj2ACVyCd=t9G9JnNPe-HgVbm6f1Cdn+LJUzYK=sJA-gbbGCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 1, 2021 at 11:29 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>
> On Tue, Mar 30, 2021 at 10:00 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> > If we want to ship this in v14 we have to make a decision ASAP:
> >
> > 1. Ship the POLLHUP patch (like v9) that only works reliably on
> > Linux. Maybe disable the feature completely on other OSes?
> > 2. Ship the patch that tries to read (like v7). It should work on
> > all systems, but it can be fooled by pipelined commands (though it can
> > detect a pipelined 'X').
> >
> > Personally, I lean towards #2.
>
> I changed my mind. Let's commit the pleasingly simple Linux-only
> feature for now, and extend to it to send some kind of no-op message
> in a later release. So this is the version I'd like to go with.
> Objections?
>
> I moved the GUC into tcop/postgres.c and tcop/tcopprot.h, because it
> directly controls postgres.c's behaviour, not pqcomm.c's. The latter
> only contains the code to perform the check.

Here's a minor comment: it would be good if we have an extra line
after variable assignments, before and after function calls/if
clauses, something like

+ pollfd.revents = 0;
+
+ rc = poll(&pollfd, 1, 0);
+
+ if (rc < 0)

And also here
}
+
+ if (CheckClientConnectionPending)
+ {
+ CheckClientConnectionPending = false;

And
+ }
+ }
+
if (ClientConnectionLost)

And
+ 0, 0, INT_MAX,
+ check_client_connection_check_interval, NULL, NULL
+ },
+
/* End-of-list marker */

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2021-04-01 12:48:44 Re: Replication slot stats misgivings
Previous Message Dave Page 2021-04-01 12:32:54 sepgsql logging