pgwire icon indicating copy to clipboard operation
pgwire copied to clipboard

High-level API for cancellation

Open sunng87 opened this issue 2 months ago • 4 comments

We already have low-level API for cancellation ready. It has necessary handler to respond CancelRequest message. However, the application user will still need to wrap everything together in order to get it work. The idea is to provide a higher level API that has all necessary part for an automatic implementation of query cancellation.

It will carry following functionality or components:

  • Backend Key generation, for both Protocol 3.0 and 3.2 secret key
  • Session management: having a centralized registry for all active session so we can find the ClientInfo via backend key
  • Capability to cancel an ongoing on_query execution in SimpleQueryHandler and ExtendedQueryHandler

Non-functional requirement:

  1. We want to make this high-level API completely optional, it can be turned on via maybe handler wrappers or some toggles. Users are allowed to have their own session management, for instance it can be a distributed session manager, and we provide this high level API as reference implementation.
  2. We want to try best not to make breaking changes to current APIs.

sunng87 avatar Dec 19 '25 02:12 sunng87