Re: FOR SHARE vs FOR UPDATE locks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <decibel(at)decibel(dot)org>
Cc: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Simon Riggs" <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: FOR SHARE vs FOR UPDATE locks
Date: 2006-12-05 16:03:33
Message-ID: 5315.1165334613@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

Jim Nasby <decibel(at)decibel(dot)org> writes:
> As for possibly using the in-memory store of multiple CIDs affecting
> a tuple, could that not work if that store contained enough
> information to 'rollback' the lock to it's original state when
> restoring to a savepoint? AFAIK other backends would only need to
> know what the current lock being held was, they wouldn't need to know
> the history of it themselves...

One of the interesting problems is that if you upgrade shared lock to
exclusive and then want to roll that back, you might need to un-block
other processes that tried to acquire share lock after you acquired
exclusive. We have no way to do that in the current implementation.
(Any such processes will be blocked on your transaction ID lock, which
you can't release without possibly unblocking the wrong processes.)

regards, tom lane

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Jeff Frost 2006-12-05 17:22:36 Re: psql man page error?
Previous Message Simon Riggs 2006-12-05 11:57:06 psql man page error?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-12-05 16:04:17 Re: Double entries in log for page slots in beta3
Previous Message Tom Lane 2006-12-05 15:49:54 Re: old synchronized scan patch