Re: [Proposal] Add foreign-server health checks infrastructure

Fujii Masao <masao.fujii@oss.nttdata.com>

From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Cc: 'Katsuragi Yuta' <katsuragiy@oss.nttdata.com>, 'vignesh C' <vignesh21@gmail.com>, 'Ted Yu' <yuzhihong@gmail.com>, 'Tom Lane' <tgl@sss.pgh.pa.us>, "'pgsql-hackers@lists.postgresql.org'" <pgsql-hackers@lists.postgresql.org>, 'Önder Kalacı' <onderkalaci@gmail.com>, "'Shinya11.Kato@oss.nttdata.com'" <Shinya11.Kato@oss.nttdata.com>, 'Kyotaro Horiguchi' <horikyota.ntt@gmail.com>, 'Shubham Khanna' <khannashubham1197@gmail.com>
Date: 2024-07-26T18:10:41Z
Lists: pgsql-hackers

On 2024/07/26 22:44, Fujii Masao wrote:
> 
> 
> On 2024/07/26 17:07, Hayato Kuroda (Fujitsu) wrote:
>> Dear Fujii-san,
>>
>> Just in case - based on the agreement in [1], I updated patches to keep them
>> consistent. We can use same pictures for further discussions...
> 
> Thanks for updating the patches! I pushed them.

The buildfarm member "hake" reported a failure in the postgres_fdw regression test.

diff -U3 /export/home/elmer/c15x/buildroot/HEAD/pgsql.build/contrib/postgres_fdw/expected/postgres_fdw.out /export/home/elmer/c15x/buildroot/HEAD/pgsql.build/contrib/postgres_fdw/results/postgres_fdw.out
--- /export/home/elmer/c15x/buildroot/HEAD/pgsql.build/contrib/postgres_fdw/expected/postgres_fdw.out	Fri Jul 26 19:16:29 2024
+++ /export/home/elmer/c15x/buildroot/HEAD/pgsql.build/contrib/postgres_fdw/results/postgres_fdw.out	Fri Jul 26 19:31:12 2024
@@ -12326,7 +12326,7 @@
    FROM postgres_fdw_get_connections(true);
   case
  ------
-    1
+    0
  (1 row)
  
  -- Clean up


The regression.diffs shows that pgfdw_conn_check returned 0 even though pgfdw_conn_checkable()
returned true. This can happen if the "revents" from poll() indicates something other than
POLLRDHUP. I think that "revents" could indicate POLLHUP, POLLERR, or POLLNVAL. Therefore,
IMO pgfdw_conn_check() should be updated as follows. I will test this change.

-               return (input_fd.revents & POLLRDHUP) ? 1 : 0;
+               return (input_fd.revents &
+                               (POLLRDHUP | POLLHUP | POLLERR | POLLNVAL)) ? 1 : 0;

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



Commits

  1. postgres_fdw: Extend postgres_fdw_get_connections to return user name.

  2. postgres_fdw: Fix bug in connection status check.

  3. postgres_fdw: Add connection status check to postgres_fdw_get_connections().

  4. postgres_fdw: Add "used_in_xact" column to postgres_fdw_get_connections().

  5. doc: Enhance documentation for postgres_fdw_get_connections() output columns.

  6. Avoid reference to nonexistent array element in ExecInitAgg().

  7. Add WL_SOCKET_CLOSED for socket shutdown events.

  8. postgres_fdw: reestablish new connection if cached one is detected as broken.