aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-02-19 23:16:15 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-02-19 23:16:15 +0000
commit617d16f4ff4959b1615cc9f57e271629c000ccff (patch)
tree95bf83d409373bdb30dfcc6e8aa46b6b529d3888
parent9650d6c7e649a9ddf42754a5f3ff3fc8539a7348 (diff)
downloadpostgresql-617d16f4ff4959b1615cc9f57e271629c000ccff.tar.gz
postgresql-617d16f4ff4959b1615cc9f57e271629c000ccff.zip
New arrangement to always let the bgwriter do checkpoints broke
CHECKPOINT and some other commands in the context of a standalone backend. Allow a standalone backend to do its own checkpoints.
-rw-r--r--src/backend/postmaster/bgwriter.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c
index 12202e00811..128122355bb 100644
--- a/src/backend/postmaster/bgwriter.c
+++ b/src/backend/postmaster/bgwriter.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.13 2005/01/10 20:02:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.14 2005/02/19 23:16:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -510,6 +510,23 @@ RequestCheckpoint(bool waitforit)
sig_atomic_t old_started = bgs->ckpt_started;
/*
+ * If in a standalone backend, just do it ourselves.
+ */
+ if (!IsPostmasterEnvironment)
+ {
+ CreateCheckPoint(false, true);
+
+ /*
+ * After any checkpoint, close all smgr files. This is so we
+ * won't hang onto smgr references to deleted files
+ * indefinitely.
+ */
+ smgrcloseall();
+
+ return;
+ }
+
+ /*
* Send signal to request checkpoint. When waitforit is false, we
* consider failure to send the signal to be nonfatal.
*/