Re: Resource Owner reassign Locks

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jeff Janes <jeff.janes@gmail.com>, Michael Paquier <michael.paquier@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2015-08-25T18:20:57Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add a small cache of locks owned by a resource owner in ResourceOwner.

On 2015-08-25 14:12:37 -0400, Tom Lane wrote:
> How would they have done that without major code surgery?  We don't have
> any hooks or function pointers involved in the users of resowner.h.
> Certainly locks would not be getting passed to a nonstandard resowner.

CurrentResourceOwner = myresowner;
/* do some op */
...
?

> > Say because they want to
> > perform some operation and then release the locks without finishing the
> > transaction.  Adding a zero argument
> > LockReleaseCurrentOwner()/LockReassignCurrentOwner() wrapper seems like
> > a small enough effort to simply not bother looking for existing callers.
> 
> I agree that a wrapper is possible, but it's not without cost; both as to
> the time required to modify the patch, and as to possibly complicating
> future back-patching because the code becomes gratuitously different in
> the back branches.  I really don't see that a wrapper is appropriate here.

Works for me.