=== Applying patches on top of PostgreSQL commit ID 1fd1bd871012732e3c6c482667d2f2c56f1a9395 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Thu Feb 20 14:24:30 UTC 2025 On branch cf/5483 nothing to commit, working tree clean === applying patch ./v2-0001-Add-very-basic-test-for-kill_prior_tuples.patch Falling back to direct application... Falling back to direct application... [cf/5483 43c67560b2] Add very basic test for kill_prior_tuples Author: Andres Freund Date: Mon Oct 28 15:48:50 2024 -0400 2 files changed, 464 insertions(+) create mode 100644 src/test/isolation/expected/index-killtuples.out create mode 100644 src/test/isolation/specs/index-killtuples.spec === applying patch ./v2-0002-heapam-Move-logic-to-handle-HEAP_MOVED-into-a-hel.patch Applied patch to 'src/backend/access/heap/heapam_visibility.c' cleanly. [cf/5483 7152d2bf83] heapam: Move logic to handle HEAP_MOVED into a helper function Author: Andres Freund Date: Mon Sep 23 12:23:33 2024 -0400 1 file changed, 61 insertions(+), 246 deletions(-) === applying patch ./v2-0003-bufmgr-Add-BufferLockHeldByMe.patch Applied patch to 'src/include/storage/bufmgr.h' cleanly. Applied patch to 'src/backend/storage/buffer/bufmgr.c' cleanly. [cf/5483 1a1d3b4179] bufmgr: Add BufferLockHeldByMe() Author: Andres Freund Date: Mon Sep 23 12:51:37 2024 -0400 2 files changed, 42 insertions(+) === applying patch ./v2-0004-heapam-Use-exclusive-lock-on-old-page-in-CLUSTER.patch Applied patch to 'src/backend/access/heap/heapam_handler.c' cleanly. Applied patch to 'src/backend/access/heap/heapam_visibility.c' cleanly. Applied patch to 'src/backend/storage/buffer/bufmgr.c' cleanly. [cf/5483 afd5a56a77] heapam: Use exclusive lock on old page in CLUSTER Author: Andres Freund Date: Thu Oct 17 11:45:36 2024 -0400 3 files changed, 20 insertions(+), 2 deletions(-) === applying patch ./v2-0005-heapam-Only-set-tuple-s-block-once-per-page-in-pa.patch Applied patch to 'src/backend/access/heap/heapam.c' cleanly. [cf/5483 da9ff7d256] heapam: Only set tuple's block once per page in pagemode Author: Andres Freund Date: Thu Oct 17 11:50:13 2024 -0400 1 file changed, 4 insertions(+), 1 deletion(-) === applying patch ./v2-0006-bufmgr-Separate-slow-fast-path-of-LockBufHdr.patch Applied patch to 'src/include/storage/buf_internals.h' cleanly. Applied patch to 'src/backend/storage/buffer/bufmgr.c' cleanly. [cf/5483 1d431c289a] bufmgr: Separate slow/fast path of LockBufHdr Author: Andres Freund Date: Tue Nov 19 12:08:38 2024 -0500 2 files changed, 37 insertions(+), 4 deletions(-) === applying patch ./v2-0007-heapam-Add-batch-mode-mvcc-check-and-use-it-in-pa.patch Applied patch to 'src/include/access/heapam.h' cleanly. Applied patch to 'src/backend/access/heap/heapam.c' cleanly. Applied patch to 'src/backend/access/heap/heapam_visibility.c' cleanly. Applied patch to 'src/tools/pgindent/typedefs.list' cleanly. [cf/5483 d1d131d02f] heapam: Add batch mode mvcc check and use it in page mode Author: Andres Freund Date: Thu Oct 17 13:16:36 2024 -0400 4 files changed, 163 insertions(+), 20 deletions(-) === applying patch ./v2-0008-bufmgr-Make-it-easier-to-change-number-of-buffer-.patch Applied patch to 'src/include/storage/buf_internals.h' cleanly. [cf/5483 4c341fb237] bufmgr: Make it easier to change number of buffer state bits Author: Andres Freund Date: Mon Oct 28 18:01:14 2024 -0400 1 file changed, 15 insertions(+), 5 deletions(-) === applying patch ./v2-0009-bufmgr-Add-interface-to-acquire-right-to-set-hint.patch Applied patch to 'src/include/storage/buf_internals.h' cleanly. Applied patch to 'src/include/storage/bufmgr.h' cleanly. Applied patch to 'src/backend/storage/buffer/README' cleanly. Applied patch to 'src/backend/storage/buffer/bufmgr.c' cleanly. Applied patch to 'src/backend/utils/activity/wait_event_names.txt' cleanly. [cf/5483 129afd1dd5] bufmgr: Add interface to acquire right to set hint bits Author: Andres Freund Date: Thu Oct 17 13:59:13 2024 -0400 5 files changed, 337 insertions(+), 34 deletions(-) === applying patch ./v2-0010-heapam-Acquire-right-to-set-hint-bits.patch Applied patch to 'src/backend/access/heap/heapam_visibility.c' cleanly. Applied patch to 'src/tools/pgindent/typedefs.list' cleanly. [cf/5483 12b7ec93ce] heapam: Acquire right to set hint bits Author: Andres Freund Date: Thu Oct 17 14:05:15 2024 -0400 2 files changed, 97 insertions(+), 18 deletions(-) === applying patch ./v2-0011-Acquire-right-to-set-hint-bits-in-the-remaining-p.patch Applied patch to 'src/backend/access/gist/gistget.c' cleanly. Applied patch to 'src/backend/access/hash/hashutil.c' cleanly. Applied patch to 'src/backend/access/nbtree/nbtinsert.c' cleanly. Applied patch to 'src/backend/access/nbtree/nbtutils.c' cleanly. Applied patch to 'src/backend/storage/freespace/freespace.c' cleanly. Applied patch to 'src/backend/storage/freespace/fsmpage.c' cleanly. [cf/5483 16167c0eec] Acquire right to set hint bits in the remaining places Author: Andres Freund Date: Mon Oct 28 16:44:11 2024 -0400 6 files changed, 57 insertions(+), 24 deletions(-) === applying patch ./v2-0012-bufmgr-Don-t-copy-pages-while-writing-out.patch Applied patch to 'src/include/storage/bufpage.h' cleanly. Applied patch to 'src/backend/access/hash/hashpage.c' cleanly. Applied patch to 'src/backend/access/transam/xloginsert.c' cleanly. Applied patch to 'src/backend/storage/buffer/bufmgr.c' cleanly. Applied patch to 'src/backend/storage/buffer/localbuf.c' cleanly. Applied patch to 'src/backend/storage/page/bufpage.c' with conflicts. Applied patch to 'src/backend/storage/smgr/bulk_write.c' cleanly. U src/backend/storage/page/bufpage.c diff --cc src/backend/storage/page/bufpage.c index 91da73dda8,f482281133..0000000000 --- a/src/backend/storage/page/bufpage.c +++ b/src/backend/storage/page/bufpage.c @@@ -1484,51 -1484,15 +1484,53 @@@ PageIndexTupleOverwrite(Page page, Offs /* * Set checksum for a page in shared buffers. * - * If checksums are disabled, or if the page is not initialized, just return - * the input. Otherwise, we must make a copy of the page before calculating - * the checksum, to prevent concurrent modifications (e.g. setting hint bits) - * from making the final checksum invalid. It doesn't matter if we include or - * exclude hints during the copy, as long as we write a valid page and - * associated checksum. + * If checksums are disabled, or if the page is not initialized, just + * return. Otherwise compute and set the checksum. * ++<<<<<<< ours + * Returns a pointer to the block-sized data that needs to be written. Uses + * statically-allocated memory, so the caller must immediately write the + * returned page and not refer to it again. + */ +char * +PageSetChecksumCopy(Page page, BlockNumber blkno) +{ + static char *pageCopy = NULL; + + /* If we don't need a checksum, just return the passed-in data */ + if (PageIsNew(page) || !DataChecksumsEnabled()) + return (char *) page; + + /* + * We allocate the copy space once and use it over on each subsequent + * call. The point of palloc'ing here, rather than having a static char + * array, is first to ensure adequate alignment for the checksumming code + * and second to avoid wasting space in processes that never call this. + */ + if (pageCopy == NULL) + pageCopy = MemoryContextAllocAligned(TopMemoryContext, + BLCKSZ, + PG_IO_ALIGN_SIZE, + 0); + + memcpy(pageCopy, page, BLCKSZ); + ((PageHeader) pageCopy)->pd_checksum = pg_checksum_page(pageCopy, blkno); + return pageCopy; +} + +/* + * Set checksum for a page in private memory. + * + * This must only be used when we know that no other process can be modifying + * the page buffer. ++======= + * In the past this needed to be done on a copy of the page, due to the + * possibility of e.g. hint bits being set concurrently. However, this is not + * necessary anymore as hint bits won't be set while IO is going on. ++>>>>>>> theirs */ void - PageSetChecksumInplace(Page page, BlockNumber blkno) + PageSetChecksum(Page page, BlockNumber blkno) { /* If we don't need a checksum, just return */ if (PageIsNew(page) || !DataChecksumsEnabled())