pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: postgres_fdw: Fix bug in connection status check.
Date: Fri, 26 Jul 2024 18:59:53 +0000
Message-ID: <E1sXQAT-001Lav-Gc@gemulon.postgresql.org> (raw)

postgres_fdw: Fix bug in connection status check.

The buildfarm member "hake" reported a failure in the regression test
added by commit 857df3cef7, where postgres_fdw_get_connections(true)
returned unexpected results.

The function postgres_fdw_get_connections(true) checks
if a connection is closed by using POLLRDHUP in the requested events
and calling poll(). Previously, the function only considered
POLLRDHUP or 0 as valid returned events. However, poll() can also
return POLLHUP, POLLERR, and/or POLLNVAL. So if any of these events
were returned, postgres_fdw_get_connections(true) would report
incorrect results. postgres_fdw_get_connections(true) failed to
account for these return events.

This commit updates postgres_fdw_get_connections(true) to correctly
report a closed connection when poll() returns not only POLLRDHUP
but also POLLHUP, POLLERR, or POLLNVAL.

Discussion: https://postgr.es/m/fd8f6186-9e1e-4b9a-92c5-e71e3697d381@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/454aab4b738e53a5dbfca9251a7807a2ad21f87e

Modified Files
--------------
contrib/postgres_fdw/connection.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



Message-ID: <E1sXQAT-001Lav-Gc@gemulon.postgresql.org>
Permalink:  ../E1sXQAT-001Lav-Gc@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sXQAT-001Lav-Gc@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: postgres_fdw: Fix bug in connection status check.
  In-Reply-To: <E1sXQAT-001Lav-Gc@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox