dblink, postgres_fdw: Handle interrupts during connection establishment
authorAndres Freund <[email protected]>
Tue, 24 Jan 2023 03:25:23 +0000 (19:25 -0800)
committerAndres Freund <[email protected]>
Tue, 24 Jan 2023 03:25:23 +0000 (19:25 -0800)
commite4602483e95bebd4da31e4ea95dc5c7f715c1e4f
tree042e471e77b308db633aa05e2a3d9913ce7473a1
parent28a591711d505f1f64c4f2eff5873ca2de0abede
dblink, postgres_fdw: Handle interrupts during connection establishment

Until now dblink and postgres_fdw did not process interrupts during connection
establishment. Besides preventing query cancellations etc, this can lead to
undetected deadlocks, as global barriers are not processed.

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

Fix the bug by using the helper from libpq-be-fe-helpers.h, introduced in a
prior commit. Besides fixing the bug, this also removes duplicated code
around reserving file descriptors.

As the change is relatively large and there are no field reports of the
problem, don't backpatch for now.

Reviewed-by: Thomas Munro <[email protected]>
Discussion: https://postgr.es/m/20220925232237[email protected]
Backpatch:
contrib/dblink/dblink.c
contrib/postgres_fdw/connection.c