Re: row level lock and table level locks

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: row level lock and table level locks
Дата
Msg-id 25736.1062991482@sss.pgh.pa.us
обсуждение исходный текст
Ответ на row level lock and table level locks  (Larry Douzie <cs4482003@yahoo.com>)
Ответы Re: row level lock and table level locks  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Re: row level lock and table level locks  (Larry Douzie <cs4482003@yahoo.com>)
Список pgsql-hackers
Larry Douzie <cs4482003@yahoo.com> writes:
>> A row lock is represented by storing the locking transaction's ID in
>> xmax and setting the HEAP_MARKED_FOR_UPDATE infomask bit. The bit is
>> needed to distinguish this from the case where the transaction is
>> deleting the tuple.

> Is there a similar bit modified if the row in question is being waited 
> upon by some transaction?

No.  We handle that case by waiting for the transaction that's locked
the row to commit or abort.  (Waiting for a transaction is done by
having every transaction take out exclusive lock on its xact ID when it
starts; then would-be waiters try to take share lock on the xact ID,
causing them to block till the exclusive lock is released.)

In general, the Postgres lock management code is not designed for
transparency :-( ... it does the jobs it's supposed to do, but it's not
always easy to inspect the visible state to find out what's happening.
Perhaps someday someone will get motivated to rewrite this stuff.
        regards, tom lane


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

Предыдущее
От: Larry Douzie
Дата:
Сообщение: row level lock and table level locks
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: row level lock and table level locks