The attached patch fixes the problem discussed here
as well as a related problem that I discovered while working on it:
select * from foo for update;
release savepoint x;
select * from foo for share;
leaves us holding only share lock not exclusive lock on the selected
tuples. That's because heap_lock_tuple() considered only the
exact-XID-equality case when checking to see if we were requesting
share lock while already holding exclusive lock. We should treat
exclusive lock held under any of the current backend's subtransactions
as not to be overridden.
In addition, this formulation avoids useless buffer-dirtying and WAL
reporting in all cases where the desired lock is already effectively held,
whereas the old code would go through the full pushups anyway.
I've only tested it against HEAD but it will need to be applied to 8.1
Anyone see any problems?
regards, tom lane
pgsql-patches by date
|Next:||From: Jim Nasby||Date: 2006-11-17 03:48:49|
|Subject: Re: Cast null to int4 upgrading from Version 7.2|
|Previous:||From: Bruce Momjian||Date: 2006-11-16 23:19:34|
|Subject: Re: [HACKERS] Extended protocol logging|