psql: Make cancel test more timing robust

Peter Eisentraut <peter@eisentraut.org>

Commit: 43d4dd87977d5ed66961605649d61973caf80f40
Author: Peter Eisentraut <peter@eisentraut.org>
Date: 2021-08-25T10:02:08Z
Releases: 15.0
psql: Make cancel test more timing robust

The previous coding relied on the PID file appearing and the query
starting "fast enough", which can fail on slow machines.  Also, there
might have been an undocumented interference between alarm and
IPC::Run.  This new coding doesn't rely on any of these concurrency
mechanisms.  Instead, we wait unitl the PID file is complete before
proceeding, and then also wait until the sleep query is registered by
the server.

Discussion: https://www.postgresql.org/message-id/flat/E1mH14Q-0002gh-HS%40gemulon.postgresql.org

Files

PathChange+/−
src/bin/psql/t/020_cancel.pl modified +27 −8

Discussion

Cited messages not in the archive: E1mH14Q-0002gh-HS@gemulon.postgresql.org