Skip to content

Commit 76b81ee

Browse files
author
Konstantin Knizhnik
committed
Move CheckPointBuffers to PreCheckPointGuts to save FSM/VM pages on normal shutdown
1 parent c9e4ff5 commit 76b81ee

File tree

1 file changed

+3
-1
lines changed
  • src/backend/access/transam

1 file changed

+3
-1
lines changed

src/backend/access/transam/xlog.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -7679,6 +7679,7 @@ PreCheckPointGuts(int flags)
76797679
if (flags & CHECKPOINT_IS_SHUTDOWN)
76807680
{
76817681
CheckPointReplicationState(flags);
7682+
CheckPointBuffers(flags);
76827683
/*
76837684
* pgstat_write_statsfile will be called later by before_shmem_exit() hook, but by then it's too late
76847685
* to write WAL records. In Neon, pgstat_write_statsfile() writes the pgstats file to the WAL, so we have
@@ -7708,7 +7709,8 @@ CheckPointGuts(XLogRecPtr checkPointRedo, int flags)
77087709
CheckPointSUBTRANS();
77097710
CheckPointMultiXact();
77107711
CheckPointPredicate();
7711-
CheckPointBuffers(flags);
7712+
if (!(flags & CHECKPOINT_IS_SHUTDOWN))
7713+
CheckPointBuffers(flags);
77127714

77137715
/* Perform all queued up fsyncs */
77147716
TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START();

0 commit comments

Comments
 (0)