pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <daniel@yesql.se>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: psql: Add test for query canceling
Date: Fri, 20 Aug 2021 23:21:09 +0200
Message-ID: <E92FAE70-66D7-4826-88D0-379004D385C7@yesql.se> (raw)
In-Reply-To: <1957503.1629485278@sss.pgh.pa.us>
References: <E1mH14Q-0002gh-HS@gemulon.postgresql.org>
	<DD279DFC-DD59-458E-B469-75DC941765A4@yesql.se>
	<alpine.DEB.2.22.394.2108201736060.498998@pseudo>
	<5F16EBAA-30D3-4C0D-840C-C2FF2739E370@yesql.se>
	<1957503.1629485278@sss.pgh.pa.us>

> On 20 Aug 2021, at 20:47, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Daniel Gustafsson <daniel@yesql.se> writes:
>> If we want the test to run but not fail the entire test suite if it fails then
>> it should use a TODO block instead, but that’s intended for tests known to fail
>> and this doesn’t seem to fall in that category.
> 
> That seems pretty useless.  If we did break things in this area,
> such a test would not help us notice.

For sure.  I wasn’t advocating it, merely indicating that the SKIP block isn’t
working the way attributed to upthread.

> The problem with the test seems blindingly obvious from here: it
> is assuming first that psql will start fast enough to print its
> PID within one second, and next that we'll be able to issue
> the cancel (and have the backend react) in less than 2 seconds
> more.  This seems about guaranteed to fail on cache-clobber
> animals, for example, but animals that are merely slow or overloaded
> would have issues too.
> 
> I think you should drop the overly-cute bit with a SIGALRM handler,
> and instead have a loop-with-delay around an attempt to read the
> psql.pid file, after launching the psql run without an immediate
> wait for termination.  That gets rid of the first problem (though
> you still want the loop to timeout eventually, it could wait up
> to say 180 seconds, as we do elsewhere).  Then the second problem
> is easy to solve by making the pg_sleep delay twice as much.

This could perhaps be done with a PostgresNode::interactive_psql session?  I
used that in a similar, but far from the same, test setup in the online
checksums patchset.

--
Daniel Gustafsson		https://vmware.com/






view thread (20+ messages)  latest in thread

Message-ID: <E92FAE70-66D7-4826-88D0-379004D385C7@yesql.se>
Permalink:  ../E92FAE70-66D7-4826-88D0-379004D385C7@yesql.se/
Also on:    postgresql.org/message-id/E92FAE70-66D7-4826-88D0-379004D385C7@yesql.se

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: daniel@yesql.se, tgl@sss.pgh.pa.us, coelho@cri.ensmp.fr, peter.eisentraut@enterprisedb.com
  Subject: Re: pgsql: psql: Add test for query canceling
  In-Reply-To: <E92FAE70-66D7-4826-88D0-379004D385C7@yesql.se>
  References: <E1mH14Q-0002gh-HS@gemulon.postgresql.org> <DD279DFC-DD59-458E-B469-75DC941765A4@yesql.se> <alpine.DEB.2.22.394.2108201736060.498998@pseudo> <5F16EBAA-30D3-4C0D-840C-C2FF2739E370@yesql.se> <1957503.1629485278@sss.pgh.pa.us> <E92FAE70-66D7-4826-88D0-379004D385C7@yesql.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox