Skip to content

Commit

Permalink
Add base_init_startup_hook
Browse files Browse the repository at this point in the history
  • Loading branch information
pashkinelfe committed Feb 29, 2024
1 parent e379850 commit 6f3d57c
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);

base_init_startup_hook_type base_init_startup_hook = NULL;

/*** InitPostgres support ***/

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

if (base_init_startup_hook)
base_init_startup_hook();

/*
* 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 (*base_init_startup_hook_type)(void);

extern PGDLLIMPORT base_init_startup_hook_type base_init_startup_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 6f3d57c

Please sign in to comment.