postgresql/contrib/postgres_fdw
Heikki Linnakangas 50c67c2019 Use ResourceOwner to track WaitEventSets.
A WaitEventSet holds file descriptors or event handles (on Windows).
If FreeWaitEventSet is not called, those fds or handles are leaked.
Use ResourceOwners to track WaitEventSets, to clean those up
automatically on error.

This was a live bug in async Append nodes, if a FDW's
ForeignAsyncRequest function failed. (In back branches, I will apply a
more localized fix for that based on PG_TRY-PG_FINALLY.)

The added test doesn't check for leaking resources, so it passed even
before this commit. But at least it covers the code path.

In the passing, fix misleading comment on what the 'nevents' argument
to WaitEventSetWait means.

Report by Alexander Lakhin, analysis and suggestion for the fix by
Tom Lane. Fixes bug #17828.

Reviewed-by: Alexander Lakhin, Thomas Munro
Discussion: https://www.postgresql.org/message-id/472235.1678387869@sss.pgh.pa.us
2023-11-23 13:31:36 +02:00
..
expected Use ResourceOwner to track WaitEventSets. 2023-11-23 13:31:36 +02:00
sql Use ResourceOwner to track WaitEventSets. 2023-11-23 13:31:36 +02:00
.gitignore Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
Makefile postgres_fdw: Add function to list cached connections to foreign servers. 2021-01-18 15:11:08 +09:00
connection.c postgres_fdw: Replace WAIT_EVENT_EXTENSION with custom wait events 2023-10-05 09:50:42 +09:00
deparse.c Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
option.c Expand some more uses of "deleg" to "delegation" or "delegated". 2023-05-21 10:55:18 -04: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 Increase DEFAULT_FDW_TUPLE_COST from 0.01 to 0.2 2023-11-02 14:30:15 +13:00
postgres_fdw.control postgres_fdw: Add function to list cached connections to foreign servers. 2021-01-18 15:11:08 +09:00
postgres_fdw.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
shippable.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00