Skip to content

Commit 25560fd

Browse files
Fix bufmgr so CHECKPOINT_END_OF_RECOVERY behaves as a shutdown checkpoint.
Recovery code documents clearly that a shutdown checkpoint is executed at end of recovery - a shutdown checkpoint WAL record is written but the buffer manager had been altered to treat end of recovery as a normal checkpoint. This bug exacerbates the bufmgr relpersistence bug. Bug spotted by Andres Freund, patch by me.
1 parent 5752e1b commit 25560fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,9 +1183,9 @@ BufferSync(int flags)
11831183

11841184
/*
11851185
* Unless this is a shutdown checkpoint, we write only permanent, dirty
1186-
* buffers. But at shutdown time, we write all dirty buffers.
1186+
* buffers. But at shutdown or end of recovery, we write all dirty buffers.
11871187
*/
1188-
if (!(flags & CHECKPOINT_IS_SHUTDOWN))
1188+
if (!((flags & CHECKPOINT_IS_SHUTDOWN) || (flags & CHECKPOINT_END_OF_RECOVERY)))
11891189
mask |= BM_PERMANENT;
11901190

11911191
/*

0 commit comments

Comments
 (0)