Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 617d16f

Browse files
committed
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.
1 parent 9650d6c commit 617d16f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/backend/postmaster/bgwriter.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.13 2005/01/10 20:02:20 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.14 2005/02/19 23:16:15 tgl Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -509,6 +509,23 @@ RequestCheckpoint(bool waitforit)
509509
sig_atomic_t old_failed = bgs->ckpt_failed;
510510
sig_atomic_t old_started = bgs->ckpt_started;
511511

512+
/*
513+
* If in a standalone backend, just do it ourselves.
514+
*/
515+
if (!IsPostmasterEnvironment)
516+
{
517+
CreateCheckPoint(false, true);
518+
519+
/*
520+
* After any checkpoint, close all smgr files. This is so we
521+
* won't hang onto smgr references to deleted files
522+
* indefinitely.
523+
*/
524+
smgrcloseall();
525+
526+
return;
527+
}
528+
512529
/*
513530
* Send signal to request checkpoint. When waitforit is false, we
514531
* consider failure to send the signal to be nonfatal.

0 commit comments

Comments
 (0)