diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 3cb51204dc..66fe9ea529 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1302,6 +1302,14 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, else buf_state |= BM_TAG_VALID | BUF_USAGECOUNT_ONE; + /* + * Initialization forks of unlogged tables need to have their dirty + * buffers written permanently to survive in case of a crash if the + * redo point is moved past the WAL-logging of the page itself. + */ + if (forkNum == INIT_FORKNUM) + buf_state |= BM_PERMANENT; + UnlockBufHdr(buf, buf_state); if (oldPartitionLock != NULL)