Re: [PATCH v1] Report specific wait events for libpq cancel requests - Mailing list pgsql-hackers

From Sagar Shedge
Subject Re: [PATCH v1] Report specific wait events for libpq cancel requests
Date
Msg-id CAPhYifHHqh+AUYECrpm-m2L6UvRq3iRefX_UOuMTeNmYrJqNtQ@mail.gmail.com
Whole thread
List pgsql-hackers

On Tue, Aug 25, 2026 at 6:18 PM Sagar Shedge <sagar.shedge92@gmail.com> wrote:
Dear Hackers,

libpqsrv_cancel() currently always reports the generic PG_WAIT_CLIENT
wait event while waiting for a cancel request to be acknowledged by
the remote server, no matter which caller invoked it. This makes it
hard to tell from pg_stat_activity whether a backend is stuck waiting
on a cancel ack versus any other generic client wait.

Attached patch adds a wait_event_info parameter to libpqsrv_cancel(),
so each caller can report a wait event specific to its own operation,
following the same pattern already used for connection and
query-result waits (e.g. PostgresFdwConnect, PostgresFdwGetResult).
postgres_fdw now reports PostgresFdwCancel, and dblink now reports
DblinkCancel, each allocated lazily via WaitEventExtensionNew() like
their sibling wait events. Documentation for both new wait events is
included.

The new wait event is documented in postgres-fdw.sgml.

--
Sagar Dilip Shedge,
Multigres Engineer, Supabase
 
--
Sagar Dilip Shedge,
Multigres Engineer, Supabase



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: fix more casting away of qualifiers
Next
From: Sami Imseih
Date:
Subject: Re: pg_stat_statements: a reset mid-query leaves an entry unnormalized forever