=== Applying patches on top of PostgreSQL commit ID 488ab592d9ea1b4c7d6e43389c34c4bbbcb8f0d4 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Mon Mar 30 19:46:24 UTC 2026 On branch cf/6334 nothing to commit, working tree clean === using 'git am' to apply patch ./v5-0001-Do-not-lock-in-BufferGetLSNAtomic-on-archs-with-8.patch === Applying: Do not lock in BufferGetLSNAtomic() on archs with 8 byte atomic reads Using index info to reconstruct a base tree... M contrib/pageinspect/heapfuncs.c M contrib/pageinspect/rawpage.c M src/backend/access/common/bufmask.c M src/backend/storage/buffer/bufmgr.c M src/include/access/gist.h M src/include/storage/bufpage.h Falling back to patching base and 3-way merge... Auto-merging src/include/storage/bufpage.h CONFLICT (content): Merge conflict in src/include/storage/bufpage.h Auto-merging src/backend/storage/buffer/bufmgr.c CONFLICT (content): Merge conflict in src/backend/storage/buffer/bufmgr.c Auto-merging src/backend/access/common/bufmask.c Auto-merging contrib/pageinspect/rawpage.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Do not lock in BufferGetLSNAtomic() on archs with 8 byte atomic reads When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v5-0001-Do-not-lock-in-BufferGetLSNAtomic-on-archs-with-8.patch === patching file contrib/pageinspect/heapfuncs.c Hunk #1 FAILED at 32. Hunk #2 FAILED at 132. Hunk #3 FAILED at 163. Hunk #4 FAILED at 209. 4 out of 4 hunks FAILED -- saving rejects to file contrib/pageinspect/heapfuncs.c.rej patching file contrib/pageinspect/rawpage.c Hunk #1 FAILED at 208. 1 out of 1 hunk FAILED -- saving rejects to file contrib/pageinspect/rawpage.c.rej patching file src/backend/access/common/bufmask.c Hunk #1 FAILED at 32. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/access/common/bufmask.c.rej patching file src/backend/storage/buffer/bufmgr.c Hunk #1 FAILED at 4628. 1 out of 1 hunk FAILED -- saving rejects to file src/backend/storage/buffer/bufmgr.c.rej patching file src/include/access/gist.h Hunk #1 FAILED at 186. 1 out of 1 hunk FAILED -- saving rejects to file src/include/access/gist.h.rej patching file src/include/storage/bufpage.h Hunk #1 FAILED at 91. Hunk #2 FAILED at 385. 2 out of 2 hunks FAILED -- saving rejects to file src/include/storage/bufpage.h.rej Removing contrib/pageinspect/heapfuncs.c.rej Removing contrib/pageinspect/rawpage.c.rej Removing src/backend/access/common/bufmask.c.rej Removing src/backend/storage/buffer/bufmgr.c.rej Removing src/include/access/gist.h.rej Removing src/include/storage/bufpage.h.rej === using 'git apply' to apply patch ./v5-0001-Do-not-lock-in-BufferGetLSNAtomic-on-archs-with-8.patch === Applied patch to 'contrib/pageinspect/heapfuncs.c' cleanly. Applied patch to 'contrib/pageinspect/rawpage.c' cleanly. Applied patch to 'src/backend/access/common/bufmask.c' cleanly. Applied patch to 'src/backend/storage/buffer/bufmgr.c' with conflicts. Applied patch to 'src/include/access/gist.h' cleanly. Applied patch to 'src/include/storage/bufpage.h' with conflicts. U src/backend/storage/buffer/bufmgr.c U src/include/storage/bufpage.h diff --cc src/backend/storage/buffer/bufmgr.c index cd21ae3fc36,4b80d43e69c..00000000000 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@@ -4681,13 -4630,9 +4681,19 @@@ BufferIsPermanent(Buffer buffer * BufferGetLSNAtomic * Retrieves the LSN of the buffer atomically. * ++<<<<<<< ours + * This is necessary for some callers who may only hold a share lock on + * the buffer. A share lock allows a concurrent backend to set hint bits + * on the page, which in turn may require a WAL record to be emitted. + * + * On platforms with 8 byte atomic reads/writes, we don't need to do any + * additional locking. On platforms not supporting such 8 byte atomic + * reads/writes, we need to actually take the header lock. ++======= + * On platforms without 8 byte atomic reads/writes we need to take a + * header lock. This is necessary for some callers who may not have an + * exclusive lock on the buffer. ++>>>>>>> theirs */ XLogRecPtr BufferGetLSNAtomic(Buffer buffer) @@@ -4703,6 -4648,6 +4709,7 @@@ char *page = BufferGetPage(buffer); BufferDesc *bufHdr; XLogRecPtr lsn; ++<<<<<<< ours /* * If we don't need locking for correctness, fastpath out. @@@ -4715,6 -4660,6 +4722,20 @@@ lsn = PageGetLSN(page); UnlockBufHdr(bufHdr); ++======= ++ ++ /* ++ * If we don't need locking for correctness, fastpath out. ++ */ ++ if (!XLogHintBitIsNeeded() || BufferIsLocal(buffer)) ++ return PageGetLSN(page); ++ ++ bufHdr = GetBufferDescriptor(buffer - 1); ++ LockBufHdr(bufHdr); ++ lsn = PageGetLSN(page); ++ UnlockBufHdr(bufHdr); ++ ++>>>>>>> theirs return lsn; } #endif diff --cc src/include/storage/bufpage.h index e5267b93fe6,2c1394478a8..00000000000 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.h @@@ -411,7 -411,7 +411,11 @@@ PageGetMaxOffsetNumber(const PageData * static inline XLogRecPtr PageGetLSN(const PageData *page) { ++<<<<<<< ours + return PageXLogRecPtrGet(&((const PageHeaderData *) page)->pd_lsn); ++======= + return PageXLogRecPtrGet(&((const volatile PageHeaderData *) page)->pd_lsn); ++>>>>>>> theirs } static inline void