postgres/contrib/postgres_fdw
Tom Lane c431986de1 postgres_fdw: re-issue cancel requests a few times if necessary.
Despite the best efforts of commit 0e5c82380, we're still seeing
occasional failures of postgres_fdw's query_cancel test in the
buildfarm.  Investigation suggests that its 100ms timeout is
still not enough to reliably ensure that the remote side starts
the query before receiving the cancel request --- and if it
hasn't, it will just discard the request because it's idle.

We discussed allowing a cancel request to kill the next-received
query, but that would have wide and perhaps unpleasant side-effects.
What seems safer is to make postgres_fdw do what a human user would
likely do, which is issue another cancel request if the first one
didn't seem to do anything.  We'll keep the same overall 30 second
grace period before concluding things are broken, but issue additional
cancel requests after 1 second, then 2 more seconds, then 4, then 8.
(The next one in series is 16 seconds, but we'll hit the 30 second
timeout before that.)

Having done that, revert the timeout in query_cancel.sql to 10 ms.
That will still be enough on most machines, most of the time, for
the remote query to start; but now we're intentionally risking the
race condition occurring sometimes in the buildfarm, so that the
repeat-cancel code path will get some testing.

As before, back-patch to v17.  We might eventually contemplate
back-patching this further, and/or adding similar logic to dblink.
But given the lack of field complaints to date, this feels like
mostly an exercise in test case stabilization, so v17 is enough.

Discussion: https://postgr.es/m/colnv3lzzmc53iu5qoawynr6qq7etn47lmggqr65ddtpjliq5d@glkveb4m6nop
2024-12-23 15:14:30 -05:00
..
expected postgres_fdw: re-issue cancel requests a few times if necessary. 2024-12-23 15:14:30 -05:00
sql postgres_fdw: re-issue cancel requests a few times if necessary. 2024-12-23 15:14:30 -05:00
.gitignore Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
connection.c postgres_fdw: re-issue cancel requests a few times if necessary. 2024-12-23 15:14:30 -05:00
deparse.c Remove unused #include's from contrib, pl, test .c files 2024-10-28 08:02:17 +01:00
Makefile postgres_fdw: Add "used_in_xact" column to postgres_fdw_get_connections(). 2024-07-26 22:15:51 +09:00
meson.build postgres_fdw: Add "used_in_xact" column to postgres_fdw_get_connections(). 2024-07-26 22:15:51 +09:00
option.c Add INT64_HEX_FORMAT and UINT64_HEX_FORMAT to c.h. 2024-11-22 12:41:57 -06:00
postgres_fdw--1.1--1.2.sql postgres_fdw: Extend postgres_fdw_get_connections to return user name. 2024-09-18 12:51:48 +09:00
postgres_fdw--1.0--1.1.sql postgres_fdw: Add functions to discard cached connections. 2021-01-26 15:35:54 +09:00
postgres_fdw--1.0.sql Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.c Introduce CompactAttribute array in TupleDesc, take 2 2024-12-20 22:31:26 +13:00
postgres_fdw.control postgres_fdw: Add "used_in_xact" column to postgres_fdw_get_connections(). 2024-07-26 22:15:51 +09:00
postgres_fdw.h Treat number of disabled nodes in a path as a separate cost metric. 2024-08-21 10:12:30 -04:00
shippable.c Update copyright for 2024 2024-01-03 20:49:05 -05:00