pgsql: Make postgres_fdw's query_cancel test less flaky.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make postgres_fdw's query_cancel test less flaky.
Date: 2024-08-30 20:47:46
Message-ID: E1sk8X4-002Ai1-13@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make postgres_fdw's query_cancel test less flaky.

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

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8749d850f962a3fe77b637ef17de9f69e0e9389d

Modified Files
--------------
contrib/postgres_fdw/expected/query_cancel.out | 26 +++++++++++++++++++-------
contrib/postgres_fdw/sql/query_cancel.sql | 18 +++++++++++++-----
2 files changed, 32 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2024-08-30 22:07:59 pgsql: Clarify restrict_nonsystem_relation_kind description.
Previous Message Peter Eisentraut 2024-08-30 19:42:20 Re: pgsql: Implement pg_wal_replay_wait() stored procedure