agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Chapman Flack <[email protected]>
Subject: [PATCH] Update README for Resource Owners.
Date: Fri, 6 Apr 2018 21:08:02 -0400

Built-in support for three more categories of owned object has accreted
without mention in the README.

Also explain that the release callbacks are global, and can consult
CurrentResourceOwner to determine the owner being released.
---
 src/backend/utils/resowner/README | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/backend/utils/resowner/README b/src/backend/utils/resowner/README
index 2998f6b..5049e7c 100644
--- a/src/backend/utils/resowner/README
+++ b/src/backend/utils/resowner/README
@@ -61,12 +61,20 @@ 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.
+several types of resource managed in the core, with the three operations
+ResourceOwnerEnlarge<Foo>Refs(), ResourceOwnerRemember<Foo>Ref(), and
+ResourceOwnerForget<Foo>Ref() for each type. The first ensures there is room
+for at least one more entry of the type, and is separate from Remember...
+so that out-of-memory can be detected before the resource is acquired.
+
+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.
+Such callbacks are registered globally, not to a specific ResourceOwner, and
+will be called during every ResourceOwnerRelease; to determine which owner is
+being released, they can refer to CurrentResourceOwner, which points to it
+while the callbacks are invoked.
 
 Whenever we are inside a transaction, the global variable
 CurrentResourceOwner shows which resource owner should be assigned
-- 
2.7.3


--------------020006050904060308080302--




view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH] Update README for Resource Owners.
  In-Reply-To: <no-message-id-246848@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox