Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f13653e

Browse files
tristan957Commitfest Bot
authored and
Commitfest Bot
committed
Add checkpoint_create_hook
Allows an extension to hook into CheckPointCreate().
1 parent c2dcf70 commit f13653e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/backend/access/transam/xlog.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ const struct config_enum_entry archive_mode_options[] = {
208208
*/
209209
CheckpointStatsData CheckpointStats;
210210

211+
checkpoint_create_hook_type checkpoint_create_hook = NULL;
212+
211213
/*
212214
* During recovery, lastFullPageWrites keeps track of full_page_writes that
213215
* the replayed WAL records indicate. It's initialized with full_page_writes
@@ -7173,6 +7175,9 @@ CreateCheckPoint(int flags)
71737175
*/
71747176
END_CRIT_SECTION();
71757177

7178+
if (checkpoint_create_hook != NULL)
7179+
checkpoint_create_hook(&checkPoint);
7180+
71767181
/*
71777182
* In some cases there are groups of actions that must all occur on one
71787183
* side or the other of a checkpoint record. Before flushing the

src/include/access/xlog.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "access/xlogbackup.h"
1515
#include "access/xlogdefs.h"
16+
#include "catalog/pg_control.h"
1617
#include "datatype/timestamp.h"
1718
#include "lib/stringinfo.h"
1819
#include "nodes/pg_list.h"
@@ -59,6 +60,9 @@ extern PGDLLIMPORT int wal_decode_buffer_size;
5960

6061
extern PGDLLIMPORT int CheckPointSegments;
6162

63+
typedef void (*checkpoint_create_hook_type) (const CheckPoint *);
64+
extern PGDLLIMPORT checkpoint_create_hook_type checkpoint_create_hook;
65+
6266
/* Archive modes */
6367
typedef enum ArchiveMode
6468
{

0 commit comments

Comments
 (0)