Skip to content

Require explicit client capability for query-level load shedding #114

In review

Description

@namasme

Problem

Query-level load-shedding rejections can disrupt clients that cannot safely recover from SQLSTATE 53000. The proxy should let a client explicitly advertise support before applying backend query admission to that connection.

Proposed approach

Add -c pg_proxy.query_load_shedding=true inside PostgreSQL startup options, using the existing proxy-option parser and runtime-to-session plumbing.

  • Only exact true opts in. Missing, false, empty, and malformed values opt out. The last occurrence wins, including malformed or empty values.
  • Store the capability for the connection lifetime.
  • Bypass query admission for unadvertised sessions. For capable sessions, the existing application-supplied backend policy still decides whether to reject work.
  • Keep connection admission and workload priority independent.
  • Test simple- and extended-protocol recovery on the same connection after 53000.
  • Leave capability adoption and policy-specific metrics to the embedding application/admission policy. Keep the existing per-attempt rejection metric unchanged; add no new counters.

This is a protocol capability, not a new enforcement policy, retry implementation, or general-purpose runtime configuration mechanism.

Behavior change

Upgrading would make unadvertised sessions bypass query shedding, including applications already supplying a backend shedder. Direct session users would explicitly set the capability in session configuration. The proposal deliberately makes query shedding opt-in rather than preserving implicit opt-in for existing clients.

Deploy the capability-aware proxy before enabling client advertisement. Older proxies can ignore the unknown option but retain their previous admission behavior.

A local implementation is ready for a draft PR; maintainer feedback on this contract is welcome before the PR is marked ready for review.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions