summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Korotkov2026-09-08 10:30:55 +0000
committerAlexander Korotkov2026-09-08 10:32:57 +0000
commit35e4b760a5e91808f315184d020e58ac2695619c (patch)
treecd070685db570aba55f795f401550e2d45f0501b
parent99c003b4dd9e29174f4883420d4ce3affb9c1a66 (diff)
Revert "Mark modified the FSM buffer as dirty during recovery"
This reverts commit c06d1a4ba6b26eef27b04074683cccade6c277ee. The commit assumed that if the FSM code tolerates torn pages, everything else does so. Readers that do not tolerate that include RelationCopyStorage(), used by ALTER TABLE ... SET TABLESPACE for every fork, the read stream in RelationCopyStorageUsingBuffer() used by CREATE DATABASE ... STRATEGY = wal_log, and, most awkwardly, the checksum verification in base backups and pg_checksums. Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20260901211837.f6.noahmisch%40microsoft.com Backpatch-through: 14 Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
-rw-r--r--src/backend/storage/freespace/freespace.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index 59128f61871..5bc96954de7 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -229,18 +229,8 @@ XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk,
if (PageIsNew(page))
PageInit(page, BLCKSZ, 0);
- /*
- * Changes to FSM are usually marked as changed using MarkBufferDirtyHint;
- * however, during recovery, it does nothing if checksums are enabled. It
- * is assumed that the page should not be dirtied during recovery while
- * modifying hints to prevent torn pages, since no new WAL data can be
- * generated at this point to store FPI. This is not relevant to the FSM
- * case, as its blocks are zeroed when a checksum mismatch occurs. So, we
- * need to use regular MarkBufferDirty here to mark the FSM block as
- * modified during recovery, otherwise changes to the FSM may be lost.
- */
if (fsm_set_avail(page, slot, new_cat))
- MarkBufferDirty(buf);
+ MarkBufferDirtyHint(buf, false);
UnlockReleaseBuffer(buf);
}