Re: [PATCH] Proposed: Have SPI_connect fail if there is no current snapshot

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Proposed: Have SPI_connect fail if there is no current snapshot
Дата
Msg-id 680.1124038974@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Proposed: Have SPI_connect fail if there is no current snapshot  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-patches
Martijn van Oosterhout <kleptog@svana.org> writes:
> You can lock a table even while you have no valid snapshot?

Certainly.  In serializable mode, you really need to be able to take out
locks before the snapshot is set --- TFM explains:

    Note also that if one is relying on explicit locking to prevent
    concurrent changes, one should use Read Committed mode, or in
    Serializable mode be careful to obtain the lock(s) before performing
    queries. A lock obtained by a serializable transaction guarantees that
    no other transactions modifying the table are still running, but if the
    snapshot seen by the transaction predates obtaining the lock, it may
    predate some now-committed changes in the table. A serializable
    transaction's snapshot is actually frozen at the start of its first
    query or data-modification command (SELECT, INSERT, UPDATE, or DELETE),
    so it's possible to obtain locks explicitly before the snapshot is
    frozen.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] For review: Server instrumentation patch
Следующее
От: Andreas Pflug
Дата:
Сообщение: Re: [HACKERS] For review: Server instrumentation patch