Fix bug in temporary file management with subtransactions. A cursor opened

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: dd7321f81ca7b87b986ac571857368454d5f3d8f
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2009-12-03T11:03:44Z
Releases: 8.3.9
Fix bug in temporary file management with subtransactions. A cursor opened
in a subtransaction stays open even if the subtransaction is aborted, so
any temporary files related to it must stay alive as well. With the patch,
we use ResourceOwners to track open temporary files and don't automatically
close them at subtransaction end (though in the normal case temporary files
are registered with the subtransaction resource owner and will therefore be
closed).

At end of top transaction, we still check that there's no temporary files
marked as close-at-end-of-transaction open, but that's now just a debugging
cross-check as the resource owner cleanup should've closed them already.

Files

PathChange+/−
src/backend/storage/file/fd.c modified +35 −32
src/backend/utils/resowner/resowner.c modified +102 −1
src/include/utils/resowner.h modified +9 −1