
This test occasionally shows +WARNING: could not get result of cancel request due to timeout which appears to be because the cancel request is sometimes unluckily sent to the remote session between queries, and then it's ignored. This patch tries to make that less probable in three ways: 1. Use a test query that does not involve remote estimates, so that no EXPLAINs are sent. 2. Make sure that the remote session is ready-to-go (transaction started, SET commands sent) before we start the timer. 3. Increase the statement_timeout to 100ms, to give the local session enough time to plan and issue the query. We might have to go higher than 100ms to make this adequately stable in the buildfarm, but let's see how it goes. Back-patch to v17 where this test was introduced. Jelte Fennema-Nio and Tom Lane Discussion: https://postgr.es/m/578934.1725045685@sss.pgh.pa.us
21 lines
798 B
PL/PgSQL
21 lines
798 B
PL/PgSQL
SELECT version() ~ 'cygwin' AS skip_test \gset
|
|
\if :skip_test
|
|
\quit
|
|
\endif
|
|
|
|
-- Let's test canceling a remote query. Use a table that does not have
|
|
-- remote_estimate enabled, else there will be multiple queries to the
|
|
-- remote and we might unluckily send the cancel in between two of them.
|
|
-- First let's confirm that the query is actually pushed down.
|
|
EXPLAIN (VERBOSE, COSTS OFF)
|
|
SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;
|
|
|
|
BEGIN;
|
|
-- Make sure that connection is open and set up.
|
|
SELECT count(*) FROM ft1 a;
|
|
-- Timeout needs to be long enough to be sure that we've sent the slow query.
|
|
SET LOCAL statement_timeout = '100ms';
|
|
-- This would take very long if not canceled:
|
|
SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;
|
|
COMMIT;
|