aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2012-09-16 19:55:27 +0100
committerSimon Riggs <simon@2ndQuadrant.com>2012-09-16 19:55:27 +0100
commit25560fdeb26f75b50793a56f69f64daab4ad586e (patch)
treee7d1b68a4d78ba0e3389aeb20663f14fb365a522
parent5752e1bbb2d9f553fd6211fbb47ab2b240d740f0 (diff)
downloadpostgresql-25560fdeb26f75b50793a56f69f64daab4ad586e.tar.gz
postgresql-25560fdeb26f75b50793a56f69f64daab4ad586e.zip
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.
-rw-r--r--src/backend/storage/buffer/bufmgr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index d7f78294207..244f4e216c3 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -1183,9 +1183,9 @@ BufferSync(int flags)
/*
* Unless this is a shutdown checkpoint, we write only permanent, dirty
- * buffers. But at shutdown time, we write all dirty buffers.
+ * buffers. But at shutdown or end of recovery, we write all dirty buffers.
*/
- if (!(flags & CHECKPOINT_IS_SHUTDOWN))
+ if (!((flags & CHECKPOINT_IS_SHUTDOWN) || (flags & CHECKPOINT_END_OF_RECOVERY)))
mask |= BM_PERMANENT;
/*