RE: [Proposal] Add foreign-server health checks infrastructure
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>
To: "osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com>, 'Önder Kalacı' <onderkalaci@gmail.com>, Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Andres Freund <andres@anarazel.de>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, "Shinya11.Kato@oss.nttdata.com" <Shinya11.Kato@oss.nttdata.com>, "zyu@yugabyte.com" <zyu@yugabyte.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: 2022-10-17T12:25:21Z
Lists: pgsql-hackers
Dear Osumi-san, > I mainly followed the steps there and > replaced the command "SELECT" for the remote table at 6-9 with "INSERT" > command. > Then, after waiting for few seconds, the "COMMIT" succeeded like below output, > even after the server stop of the worker side. > Additionally, the last reference "SELECT" which failed above can succeed, > if I restart the worker server before the "SELECT" command to the remote table. > This means the transaction looks successful but the data isn't there ? > Could you please have a look at this issue ? Good catch. This was occurred because we disconnected the crashed server. Previously the failed server had been disconnected in the pgfdw_connection_check(). It was OK if the transaction(or statement) was surely cacneled. But currently the statement might be not canceled because QueryCancelPending might be cleaned up[1]. If we failed to cancel statements and reached pgfdw_xact_callback(), the connection would not be used because entry->conn is NULL. That's why you sucseeded to do "COMMIT". However, the backend did not send "COMMIT" command to the srever, so inserted data was vanished on remote server. I understood that we should not call disconnect_pg_server(entry->conn) even if we detect the disconnection. If should be controlled in Xact callback. This will be modified in next version. Moreover, I noticed that we should enable timer even if the QueryCancelMessage was not NULL. If we do not turn on here, the checking will be never enabled again. [1]: https://www.postgresql.org/message-id/TYAPR01MB5866CE34430424A588F60FC2F55D9%40TYAPR01MB5866.jpnprd01.prod.outlook.com Best Regards, Hayato Kuroda FUJITSU LIMITED
Commits
-
postgres_fdw: Extend postgres_fdw_get_connections to return user name.
- 4f08ab554577 18.0 landed
-
postgres_fdw: Fix bug in connection status check.
- 454aab4b738e 18.0 landed
-
postgres_fdw: Add connection status check to postgres_fdw_get_connections().
- 857df3cef7be 18.0 landed
-
postgres_fdw: Add "used_in_xact" column to postgres_fdw_get_connections().
- c297a47c5f8d 18.0 landed
-
doc: Enhance documentation for postgres_fdw_get_connections() output columns.
- 284c030a10b8 18.0 landed
-
Avoid reference to nonexistent array element in ExecInitAgg().
- 92957ed98c5c 16.0 cited
-
Add WL_SOCKET_CLOSED for socket shutdown events.
- 50e570a59e7f 15.0 cited
-
postgres_fdw: reestablish new connection if cached one is detected as broken.
- 32a9c0bdf493 14.0 cited