postgresql/src/backend/storage
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
..
buffer Make ResourceOwners more easily extensible. 2023-11-08 13:30:50 +02:00
file Prevent overflow for block number in buffile.c 2023-11-20 09:14:53 +09:00
freespace ExtendBufferedWhat -> BufferManagerRelation. 2023-08-23 12:31:23 +12:00
ipc Use ResourceOwner to track WaitEventSets. 2023-11-23 13:31:36 +02:00
large_object doc: correct reference to pg_relation in comment 2023-09-26 17:07:14 -04:00
lmgr Make ResourceOwners more easily extensible. 2023-11-08 13:30:50 +02:00
page Introduce PG_IO_ALIGN_SIZE and align all I/O buffers. 2023-04-08 16:34:50 +12:00
smgr Invalidate smgr_targblock in smgrrelease(). 2023-08-17 15:45:13 +12:00
sync Remove a few unused global variables and declarations. 2023-06-12 16:25:37 +03:00
Makefile Refactor the fsync queue for wider use. 2019-04-04 23:38:38 +13:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00