pgsql: Do not lock in BufferGetLSNAtomic() on archs with 8 byte atomic
| От | Tomas Vondra |
|---|---|
| Тема | pgsql: Do not lock in BufferGetLSNAtomic() on archs with 8 byte atomic |
| Дата | |
| Msg-id | E1w0ObH-003VWH-0A@gemulon.postgresql.org обсуждение исходный текст |
| Список | pgsql-committers |
Do not lock in BufferGetLSNAtomic() on archs with 8 byte atomic reads On platforms where we can read or write the whole LSN atomically, we do not need to lock the buffer header to prevent torn LSNs. We can do this only on platforms with PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY, and when the pd_lsn field is properly aligned. For historical reasons the PageXLogRecPtr was defined as a struct with two uint32 fields. This replaces it with a single uint64 value, to make the intent clearer. To prevent issues with weak typedefs the value is still wrapped in a struct. This also adjusts heapfuncs() in pageinspect, to ensure proper alignment when reading the LSN from a page on alignment-sensitive hardware. Idea by Andres Freund. Initial patch by Andreas Karlsson, improved by Peter Geoghegan. Minor tweaks by me. Author: Andreas Karlsson <andreas@proxel.se> Author: Peter Geoghegan <pg@bowt.ie> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Tomas Vondra <tomas@vondra.me> Discussion: https://postgr.es/m/b6610c3b-3f59-465a-bdbb-8e9259f0abc4@proxel.se Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/943e881733ca62ea2e1ceb20e79b3d149379755d Modified Files -------------- contrib/pageinspect/heapfuncs.c | 13 +++------- contrib/pageinspect/rawpage.c | 8 +++--- src/backend/access/common/bufmask.c | 2 +- src/backend/storage/buffer/bufmgr.c | 49 +++++++++++++++++++++++-------------- src/include/access/gist.h | 4 +-- src/include/storage/bufpage.h | 47 +++++++++++++++++++++++++++-------- 6 files changed, 76 insertions(+), 47 deletions(-)
В списке pgsql-committers по дате отправления: