aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2021-09-15 10:47:44 +0900
committerMichael Paquier <michael@paquier.xyz>2021-09-15 10:47:44 +0900
commitcae6fc2bc27cdb072693076249ce688f048ca7b7 (patch)
tree4cdb2150232243e94f7dc399c47632653833c8e8 /src
parent69e31d05b0a33f55aa5d9540917540f5fccb93a7 (diff)
downloadpostgresql-cae6fc2bc27cdb072693076249ce688f048ca7b7.tar.gz
postgresql-cae6fc2bc27cdb072693076249ce688f048ca7b7.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/resowner/README15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/backend/utils/resowner/README b/src/backend/utils/resowner/README
index 2998f6bb362..f94c9700df4 100644
--- a/src/backend/utils/resowner/README
+++ b/src/backend/utils/resowner/README
@@ -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