Skip to content

Commit

Permalink
Add recovery_cleanup_hook
Browse files Browse the repository at this point in the history
  • Loading branch information
pashkinelfe committed Feb 28, 2024
1 parent e379850 commit 0c998fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/utils/init/postinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void ClientCheckTimeoutHandler(void);
static bool ThereIsAtLeastOneRole(void);
static void process_startup_options(Port *port, bool am_superuser);
static void process_settings(Oid databaseid, Oid roleid);

recovery_cleanup_hook_type recovery_cleanup_hook = NULL;

/*** InitPostgres support ***/

Expand Down Expand Up @@ -641,6 +641,9 @@ BaseInit(void)
*/
InitFileAccess();

if (recovery_cleanup_hook)
(*recovery_cleanup_hook) (void);

/*
* Initialize statistics reporting. This needs to happen early to ensure
* that pgstat's shutdown callback runs after the shutdown callbacks of
Expand Down
4 changes: 4 additions & 0 deletions src/include/postmaster/postmaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ extern int MaxLivePostmasterChildren(void);

extern bool PostmasterMarkPIDForWorkerNotify(int);

typedef void (*recovery_cleanup_hook_type)(void);

extern PGDLLIMPORT recovery_cleanup_hook_type recovery_cleanup_hook;

#ifdef EXEC_BACKEND
extern pid_t postmaster_forkexec(int argc, char *argv[]);
extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn();
Expand Down

0 comments on commit 0c998fe

Please sign in to comment.