Re: questions about concurrency control in Postgresql

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: questions about concurrency control in Postgresql
Дата
Msg-id 407d949e0912080416vd8377c8pb6877d64254138fb@mail.gmail.com
обсуждение исходный текст
Ответ на questions about concurrency control in Postgresql  (黄晓骋 <huangxclife@gmail.com>)
Ответы 答复: questions about concurrency control in Postgresql
答复: questions about concurrency control in Postgresql
Список pgsql-hackers
2009/12/8 黄晓骋 <huangxclife@gmail.com>:
> From the above, I think the tuple lock is unnecessary, because it uses
> transaction lock.
>
> Besides, tuple lock is unlocked after the tuple is updated but not after the
> transaction commits. I mean it's not 2PL.

It's a two step process. An update marks the tuple locked. Another
transaction which comes along and wants to lock the tuple waits on the
transaction marked on the tuple. When the first transaction commits or
aborts then the second transaction can proceed and lock the tuple
itself. The reason we need both locks is because the first transaction
cannot go around the whole database finding every tuple it ever locked
to unlock it, firstly that could be a very large list and secondly
there would be no way to do that atomically.

Tuple locks and all user-visible locks are indeed held until the end
of the transaction.

--
greg


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Streaming replication, some small issues
Следующее
От: Tim Bunce
Дата:
Сообщение: Re: YAML