pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic
Дата
Msg-id E1eZ0Dx-0008OK-1d@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Change some bogus PageGetLSN calls to BufferGetLSNAtomic

As src/backend/access/transam/README says, PageGetLSN may only be called
by processes holding either exclusive lock on buffer, or a shared lock
on buffer plus buffer header lock.  Therefore any place that only holds
a shared buffer lock must use BufferGetLSNAtomic instead of PageGetLSN,
which internally obtains buffer header lock prior to reading the LSN.

A few callsites failed to comply with this rule.  This was detected by
running all tests under a new (not committed) assertion that verifies
PageGetLSN locking contract.  All but one of the callsites that failed
the assertion are fixed by this patch.  Remaining callsites were
inspected manually and determined not to need any change.

The exception (unfixed callsite) is in TestForOldSnapshot, which only
has a Page argument, making it impossible to access the corresponding
Buffer from it.  Fixing that seems a much larger patch that will have to
be done separately; and that's just as well, since it was only
introduced in 9.6 and other bugs are much older.

Some of these bugs are ancient; backpatch all the way back to 9.3.

Authors: Jacob Champion, Asim Praveen, Ashwin Agrawal
Reviewed-by: Michaël Paquier
Discussion: https://postgr.es/m/CABAq_6GXgQDVu3u12mK9O5Xt5abBZWQ0V40LZCE+oUf95XyNFg@mail.gmail.com

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c6187964047f5892fb91e3af170996a93af33ed9

Modified Files
--------------
src/backend/access/gist/gist.c       | 5 +++--
src/backend/access/gist/gistvacuum.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: pgsql: Implement TZH and TZM timestamp format patterns
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Expression evaluation based aggregate transition invocation.