Hackers,

I just figured that if we let LockRelation use GetCurrentTransactionId()
then the wrong thing happens if we let large objects survive
subtransaction commit/abort.  The problem is that when closing a large
object at main transaction commit, which was opened inside a
subtransaction, the code tries to UnlockRelation(pg_largeobject), and
use the main transaction Xid (instead of the subtransaction Xid that it
used to LockRelation()).

So I have changed it to use GetTopTransactionId() instead.  Is that OK
with everybody?

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Maybe there's lots of data loss but the records of data loss are also lost.
(Lincoln Yeoh)


Thu, 22 Jul 2004 23:05:40 -0400
Alvaro Herrera <alvherre@dcc.uchile.cl>
make LockRelation use top transaction ID
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> I just figured that if we let LockRelation use GetCurrentTransactionId()
> then the wrong thing happens if we let large objects survive
> subtransaction commit/abort.

> So I have changed it to use GetTopTransactionId() instead.  Is that OK
> with everybody?

No, at least not if you made that a global change.  Doing it that way
will mean that a failed subtransaction will not release its locks, no?

			regards, tom lane

Fri, 23 Jul 2004 09:49:05 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: make LockRelation use top transaction ID 
On Fri, Jul 23, 2004 at 09:49:05AM -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> > I just figured that if we let LockRelation use GetCurrentTransactionId()
> > then the wrong thing happens if we let large objects survive
> > subtransaction commit/abort.
> 
> > So I have changed it to use GetTopTransactionId() instead.  Is that OK
> > with everybody?
> 
> No, at least not if you made that a global change.  Doing it that way
> will mean that a failed subtransaction will not release its locks, no?

Hmm ... won't they be released when the ResourceOwner is released?

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Ni aun el genio muy grande llegarï¿½a muy lejos
si tuviera que sacarlo todo de su propio interior" (Goethe)


Sat, 24 Jul 2004 11:03:51 -0400
Alvaro Herrera <alvherre@dcc.uchile.cl>
Re: make LockRelation use top transaction ID
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> On Fri, Jul 23, 2004 at 09:49:05AM -0400, Tom Lane wrote:
>> No, at least not if you made that a global change.  Doing it that way
>> will mean that a failed subtransaction will not release its locks, no?

> Hmm ... won't they be released when the ResourceOwner is released?

Er ... duh.  Still stuck in pre-ResourceOwner ways of thinking ;-)

Now that I'm more awake, I recall that I actually considered changing
the lock code to take all locks in the name of the TopTransaction as
part of the ResourceOwner patch.  But I decided to leave well enough
alone because I hadn't time to think about all the implications.
Yeah, if you don't see any problem, go for it.

			regards, tom lane

Sat, 24 Jul 2004 16:08:19 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: make LockRelation use top transaction ID 