pgsql: Add helper library for use of libpq inside the server environmen

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add helper library for use of libpq inside the server environmen
Date: 2025-04-03 16:36:55
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add helper library for use of libpq inside the server environment

Currently dblink and postgres_fdw don't process interrupts during connection
establishment. Besides preventing query cancellations etc, this can lead to
undetected deadlocks, as global barriers are not processed.

Libpqwalreceiver in contrast, processes interrupts during connection
establishment. The required code is not trivial, so duplicating it into
additional places does not seem like a good option.

These aforementioned undetected deadlocks are the reason for the spate of CI
test failures in the FreeBSD 'test_running' step.

For now the helper library is just a header, as it needs to be linked into
each extension using libpq, and it seems too small to be worth adding a
dedicated static library for.

The conversion to the helper are done in subsequent commits.

Reviewed-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Discussion: https://postgr.es/m/[email protected]

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/aa435d7c42a09f7019805d1cf87eb64545efe1bc
Author: Andres Freund <andres(at)anarazel(dot)de>

Modified Files
--------------
src/include/libpq/libpq-be-fe-helpers.h | 242 ++++++++++++++++++++++++++++++++
1 file changed, 242 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2025-04-03 17:30:29 pgsql: Restrict copying of invalidated replication slots.
Previous Message Álvaro Herrera 2025-04-03 15:50:24 pgsql: Remove duplicate set of print_notnull