Re: pgsql: psql: Add test for query canceling

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: psql: Add test for query canceling
Date: 2021-08-24 18:26:40
Message-ID: 49FB9125-8FAC-4B2A-B440-0A2CF16642CF@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

> On 24 Aug 2021, at 18:43, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
> On 20.08.21 20:47, Tom Lane wrote:
>> 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.
>
> Here is a proposal. It waits separately for the pid file to appear and also checks for the sleep query to be registered by the backend, so it doesn't have any more dependencies on things happening "fast enough". And it's also faster in the normal case now. Thoughts?

From reading the patch, that looks like a really good combination of ideas for
this test. +1.

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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-08-24 20:37:54 pgsql: Fix regexp misbehavior with capturing parens inside "{0}".
Previous Message Tom Lane 2021-08-24 16:59:10 Re: pgsql: psql: Add test for query canceling