Re: pgsql: psql: Add test for query canceling - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: psql: Add test for query canceling
Date
Msg-id 350197.1629824350@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: psql: Add test for query canceling  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: pgsql: psql: Add test for query canceling  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-committers
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> 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?

That looks pretty solid to me, and I can confirm that it passes
on wrasse's host.  The only nit I can find to pick is that this:

+    usleep(10_000) until -s "$tempdir/psql.pid" or ($count++ > 180 * 100 and die 'pid file did not appear');

basically assumes that psql.pid will be written atomically.
It'd be marginally safer to wait till psql.pid can be seen to
contain a newline.  I don't think that would be too hard to do,
if you put the slurp_file call inside the wait loop and inspect
its result.

            regards, tom lane



pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pgsql: psql: Add test for query canceling
Next
From: Daniel Gustafsson
Date:
Subject: Re: pgsql: psql: Add test for query canceling