Re: FOR SHARE vs FOR UPDATE locks

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: FOR SHARE vs FOR UPDATE locks
Дата
Msg-id 758.1164995911@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: FOR SHARE vs FOR UPDATE locks  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
Список pgsql-hackers
"Heikki Linnakangas" <heikki@enterprisedb.com> writes:
> Yeah. Even without a real update, I just figured you can't upgrade a 
> shared lock held by an arbitrarily chosen parent to an exclusive lock. 
> If that subxid aborts, and if any of the parents of that subtransaction 
> held the shared lock, that lock would be released incorrectly. Which is 
> essentially the same problem we began with.

Well, there's nothing "arbitrarily chosen" about it, because the lock
shown in the tuple would always be the most senior live subtransaction.
So I don't think your concern above is a real problem.  Nonetheless, the
proposed hack is definitely playing some games with the semantics, and
while we might be able to get away with that for the question of "is this
lock shared or exclusive", it certainly won't do for an actual update.

> Let's throw an error for now. We have to come back to this in 8.3, I think.

I think it's OK to fix it so that we allow the pre-existing lock to be
held by a subtransaction of the current xact, but not a parent.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: 8.2 Beta3-> RC1 upgrade
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: FOR SHARE vs FOR UPDATE locks