[PATCH v1] Report specific wait events for libpq cancel requests

From: Sagar Shedge <sagar(dot)shedge92(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH v1] Report specific wait events for libpq cancel requests
Date: 2026-08-25 12:48:00
Message-ID: CAPhYifF7coCJaRWxRzHn2sAmoa0uOPS8d2Ow67n9FcmS5w=98g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-Report-specific-wait-events-for-libpq-cancel-request.patch application/octet-stream 5.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-08-25 12:48:15 aio: Async fsyncs for crash recovery and checkpointer
Previous Message Daniel Gustafsson 2026-08-25 12:33:30 Re: right() returns the whole string for the most negative n