From 7e50554f03bfaa1235c985d30cb0c2ac0e937b71 Mon Sep 17 00:00:00 2001 From: Alexander Korotkov Date: Mon, 14 Oct 2024 16:22:14 +0300 Subject: [PATCH] Move CheckPoint_hook() call after CheckPointBuffers() That allows to process flushed buffers in CheckPoint_hook(). --- src/backend/access/transam/xlog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index c2820f29e7c..ee0794465b1 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7041,8 +7041,6 @@ CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn, XLogRecPtr pagePtr, static void CheckPointGuts(XLogRecPtr checkPointRedo, int flags) { - if (CheckPoint_hook) - CheckPoint_hook(checkPointRedo, flags); CheckPointRelationMap(); CheckPointReplicationSlots(); CheckPointSnapBuild(); @@ -7059,6 +7057,9 @@ CheckPointGuts(XLogRecPtr checkPointRedo, int flags) CheckPointPredicate(); CheckPointBuffers(flags); + if (CheckPoint_hook) + CheckPoint_hook(checkPointRedo, flags); + /* Perform all queued up fsyncs */ TRACE_POSTGRESQL_BUFFER_CHECKPOINT_SYNC_START(); CheckpointStats.ckpt_sync_t = GetCurrentTimestamp();