summaryrefslogtreecommitdiff
path: root/src/backend/access/heap/heapam.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r--src/backend/access/heap/heapam.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 1273d1201ff..4f52f05c290 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -4395,6 +4395,16 @@ heap_xlog_newpage(XLogRecPtr lsn, XLogRecord *record)
}
MarkBufferDirty(buffer);
+
+ /*
+ * At the end of crash recovery the init forks of unlogged relations are
+ * copied, without going through shared buffers. So we need to force the
+ * on-disk state of init forks to always be in sync with the state in
+ * shared buffers.
+ */
+ if (xlrec->forknum == INIT_FORKNUM)
+ FlushOneBuffer(buffer);
+
UnlockReleaseBuffer(buffer);
}