v1-0001-Fix-logging-of-non-standard-pages-in-RelationCopy.patch
application/octet-stream
Filename: v1-0001-Fix-logging-of-non-standard-pages-in-RelationCopy.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0001
Subject: Fix logging of non-standard pages in RelationCopyStorageUsingBuffer
| File | + | − |
|---|---|---|
| src/backend/storage/buffer/bufmgr.c | 6 | 2 |
From ca3e957b7684c5e67ff8868f6d53cbcf9e4e4d1f Mon Sep 17 00:00:00 2001 From: Matthias van de Meent <boekewurm+postgres@gmail.com> Date: Mon, 13 May 2024 13:48:04 +0200 Subject: [PATCH v1] Fix logging of non-standard pages in RelationCopyStorageUsingBuffer If the data in the page is non-standard (e.g. the VM, FSM, or an access method that doesn't update PageHeader's fields as required) then we may fail to WAL-log the data on that page. When the server crashes after flushing the WAL record, but before flushing the file writes, this data may be permanently lost. Reported-By: Konstantin Knizhnik --- src/backend/storage/buffer/bufmgr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 49637284f9..6a3b9357db 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -4695,9 +4695,13 @@ RelationCopyStorageUsingBuffer(RelFileLocator srclocator, memcpy(dstPage, srcPage, BLCKSZ); MarkBufferDirty(dstBuf); - /* WAL-log the copied page. */ + /* + * WAL-log the copied page. + * Note that we don't know about the type of data contained in the + * page, so we can't report that the buffer is a standard page. + */ if (use_wal) - log_newpage_buffer(dstBuf, true); + log_newpage_buffer(dstBuf, false); END_CRIT_SECTION(); -- 2.40.1