Update README for resource owners about the resource types supported

All the types supported were listed directly in the README, but it was
very outdated.  Rather than listing all the types supported in the
README, this commit adds a reference to look at ResourceOwnerData in
resowner.c to get this information.

The order of the paragraphs is reworked a bit for clarity.

Author: Amit Langote
Discussion: https://postgr.es/m/CA+HiwqHtfT9z=4H5+F7DOy0OyNHAaVwuRcakt9b2t2uADOaiag@mail.gmail.com
This commit is contained in:
Michael Paquier 2021-09-15 10:47:44 +09:00
parent 69e31d05b0
commit cae6fc2bc2

View File

@ -54,20 +54,19 @@ The basic operations on a ResourceOwner are:
* delete a ResourceOwner (including child owner objects); all resources
must have been released beforehand
This API directly supports the resource types listed in the definition of
ResourceOwnerData struct in src/backend/utils/resowner/resowner.c.
Other objects can be associated with a ResourceOwner by recording the address
of the owning ResourceOwner in such an object. There is an API for other
modules to get control during ResourceOwner release, so that they can scan
their own data structures to find the objects that need to be deleted.
Locks are handled specially because in non-error situations a lock should
be held until end of transaction, even if it was originally taken by a
subtransaction or portal. Therefore, the "release" operation on a child
ResourceOwner transfers lock ownership to the parent instead of actually
releasing the lock, if isCommit is true.
Currently, ResourceOwners contain direct support for recording ownership of
buffer pins, lmgr locks, and catcache, relcache, plancache, tupdesc, and
snapshot references. Other objects can be associated with a ResourceOwner by
recording the address of the owning ResourceOwner in such an object. There is
an API for other modules to get control during ResourceOwner release, so that
they can scan their own data structures to find the objects that need to be
deleted.
Whenever we are inside a transaction, the global variable
CurrentResourceOwner shows which resource owner should be assigned
ownership of acquired resources. Note however that CurrentResourceOwner