2ndQuadrant / pglogical

Logical Replication extension for PostgreSQL 15, 14, 13, 12, 11, 10, 9.6, 9.5, 9.4 (Postgres), providing much faster replication than Slony, Bucardo or Londiste, as well as cross-version upgrades.
http://2ndquadrant.com/en/resources/pglogical/
Other
987 stars 153 forks source link

Make backend query execution interruptible. #454

Open nmisch opened 8 months ago

nmisch commented 8 months ago

This prevents v15+ DROP DATABASE hanging when a pglogical process waits inside one of these calls. (See https://github.com/2ndQuadrant/pglogical/issues/418 for fixes of that symptom under different conditions.) In all versions, it brings responsiveness of these calls to query cancel, backend termination, and fast shutdown.

Future work should include adopting libpqsrv_connect_params(). I didn't bundle that in this pull request, because that function doesn't support all the connection parameters that PQconnectdbParams() supports. Specifically, since libpqsrv_connect_params() wraps PQconnectStartParams(), it has the limitations discussed in https://postgr.es/m/flat/CA%2Bmi_8YyGKA9dWELu63e%3DKL2oN-%2BFe4uca4EtFfb6uQD4Up8pw%40mail.gmail.com. Future work should also bring interruptibility to calls of PQgetCopyData(async=false), PQputCopyData(), and PQputCopyEnd().

No new test failures in:

When v17 support appears, compat17/pglogical_compat.h can just #include "libpq/libpq-be-fe-helpers.h" rather than use the local copy.