From 118141ea19f09912f48ec0c955a9cc1d99189d84 Mon Sep 17 00:00:00 2001 From: Narek Galstyan Date: Wed, 4 Nov 2026 15:42:38 -0500 Subject: [PATCH 1/2] Flush init fork pages after generic WAL delta redo Generic WAL records can now modify the init fork of an unlogged relation. At the end of crash recovery and on standby promotion, ResetUnloggedRelations() copies the init fork over the main fork from disk, bypassing shared buffers, so replayed init fork pages must be on disk by then. XLogReadBufferForRedoExtended() flushes init fork pages restored from a full-page image, but generic_redo() only marked the buffer dirty after applying a delta. An access method that updates an init fork page without GENERIC_XLOG_FULL_IMAGE, in the same checkpoint cycle as the page's last full-page image or with full_page_writes off, would then get its main fork from the stale on-disk copy. Call XLogFlushBufferForRedoIfInit() after applying a delta, as hash and sequence redo do. Commit 8e684ce11dd added that helper when seq_redo() had the same problem. generic_redo() did not need it then, since generic WAL never logged init fork pages. --- src/backend/access/transam/generic_xlog.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/access/transam/generic_xlog.c b/src/backend/access/transam/generic_xlog.c index ac7caaeb138..34b5a062d8c 100644 --- a/src/backend/access/transam/generic_xlog.c +++ b/src/backend/access/transam/generic_xlog.c @@ -543,6 +543,7 @@ generic_redo(XLogReaderState *record) PageSetLSN(page, lsn); MarkBufferDirty(buffers[block_id]); + XLogFlushBufferForRedoIfInit(record, block_id, buffers[block_id]); } } -- 2.50.1 (Apple Git-155)